So a lot of people would encounter this problem when they try to change the permalink option to look more like this
- http://yourwebsite.com/month/day/postname
- http://yourwebsite.com/month/postname
- http://yourwebsite.com/postname
But once changed the settings it suddenly turns out to be Page Not Found.
I have encountered this problem lately either, and this is the ultimate solution for it:
Two things, one is to check your .htaccess
file, and the other is Apache. First, .htaccess
is at your website root folder (something like /var/www
or /var/www/xxx.com
, or simply go to your provider and ask them where it is) and it’s invisible by default. So you need to type
ls -a
to show the file.
Open the file:
nano .htaccess
Check has the file changed after you changed the settings at WordPress admin panel, if not, that’s the problem.
OK, so now, let’s head to Apache folder. Because it’s for 2 things you haven’t enabled in Apache.
cd /etc/apache2
Because I have installed Apache2.
Now:
a2enmod rewrite
Not done yet, this enabled your mod_rewrite
module but it’s not enough for a vanilla system.
cd /etc/apache2/sites-available
This is the step to change the AllowOverride
option.
nano default
Find the lines, it should look like this:
AllowOverride None
Change them to
AllowOverride All
Then, get back to your WordPress admin panel and change the Permalinks settings again.
Here you go, it’s done, check your posts to see if it worked.
For safety reason, you can now go back to VirtualHost/default
file and change them back to None,
because the AllowOverride
allows Apache to recognize the .htaccess
file and if it’s None
, the system would automatically ignore the .htaccess
file, if you are worried for further changes could affect the Apache server, I recommend you change them back to None
.
And your permalink is set!