Permalinks help people see the topic of a page before it’s visited and generally mean that search engines will rank them higher too.
OK, so you’re getting 404’s as soon as you enable permalinks other than the default?
Firstly, make sure mod_rewrite is loaded. The easiest way is to use the phpinfo() function. This can be done by creating a php file containing the following code:
1 2 3
<?php phpinfo(); ?>
You can then check the output of the phpinfo() function to see if ‘mod_rewrite’ in enabled.
If mod_rewrite is not enabled, you will need to enable it on the command line by typing:
You’ll then want to restart apache with
If this doesn’t fix the problem, browse to the root of your website and check if the file ‘.htaccess’ exists.
If it doesn’t, create one by typing
Make sure the .htaccess file is writeable with
chmod 755 .htaccess
If it’s still not working, check your apache config files. The root directory of your website must have AllowOverride set to all. For example, in the file /etc/apache2/sites-available/sitename
1 2 3
<Directory /srv/www/> AllowOverride All </Directory>
Just make sure the AllowOverride is set to All. The other items should stay the same.
Restart apache and hopefully your 404 errors will be gone.
Tell me how it goes…..