I have been working on a website on an ubuntu server (amazone) and I get 404s entering pages.
I'll give all the information I can regarding the problem.
On WordPress
Refresh page:
I followed this tutorial:
https://wordpress.org/support/topic/solved-permalinks-working-in-apache2-ubuntu-1010?replies=6
And nothing helped.
I found this post https://wordpress.org/support/topic/permalink-does-not-work-apart-from-default?replies=12 - so I entered
I entered the file: /etc/apache2/sites-enabled/000-default.conf
and didn't find AllowOverride None
to change to AllowOverride All
So I added it myself here:
Restarted apache, and I got an error. I refreshed the website, and found out it's not working..
Undo AllowOverride All
from 000-default.conf
What is the solution for this? I have never worked with Linux servers, so I'll need a very clear and well explained answer please.
BTW, This is what WP generates in my .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Open a terminal and type:
Find this:
Change
AllowOverride None
toAllowOverride All
Then run:
Dont forget to restart apache2:
You can check if there exist an htaccess file in your WordPress home directory as shown above. If it is not there create one:
and copy paste the below to it
Press ctrl+x and press y to save the file. And restart apache by
$ sudo service apache2 restart
You would want to tell apache to follow your .htaccess file. You can do this by editing the apache.conf file
Scroll down to the line By default it will be:
change the value of AllowOverride to All so now it becomes:
Press ctrl+x and press y to save the configuration file. In order to make this changes to server first enable the mod_rewrite by.
And then restart the server
Done!
Source: https://www.wst.space/riddling-with-wordpress-permalink-setup-issues/