If you discover after moving your WordPress site to a new host that your category and tag permalinks no longer work, don’t panic. The 404 errors you are seeing are usually the result of one or more of the following three issues:

WordPress (Photo credit: Adriano Gasparri)
- Mod_rewrite is not loaded on your web server
- .htaccess is not writable by your web server
- AllowOverride is set to “None”
Troubleshooting these issues is fairly straightforward, especially if you have shell access to your web server. If you are moving to a new vps, fixing these issues will only take a few minutes, but if moving to another shared server, you may require help from your hosting provider, especially for mod_rewrite access.
As this issue usually occurs when moving to a new virtual private server, I will describe the troubleshooting steps for a vps running Apache, as this is the most common configuration. For shared hosting, a support ticket is usually all that’s required since most hosting providers are familiar enough with WordPress to quickly fix your 404 issue.
Step 1. Verify that mod_rewrite is loaded on the web server.
Mod_rewrite is an Apache module used to re-write URLs on the fly according to rules and conditions specified in the .htaccess file. If this module is not loaded during the start-up of your web server, the rules specified in .htaccess are ignored.
The rules specified in the WordPress section of the .htaccess are critical to the proper re-writing of the URLs necessary for proper functioning of category and tags when using customized permalinks. If you are using the default permalink configuration, re-writes are not required and your categories and tags will work even without mod_rewrite. This fact is what makes people pull out their hair when trying to figure out what’s going on with their server.
To verify that Apache has loaded mod_rewrite, login to your shell and enter:
bash# apache2ctl -M | grep rewrite
Your server should respond with something like:
bash# rewrite_module (shared)
If nothing is returned, consult your distribution’s documentation on how to load a module. For Ubuntu it is as simple as running:
bash# sudo a2enmod rewrite
bash# sudo service apache2 restart
If using a shared server, contact your provider and make sure they have mod_rewrite configured to load when the web service starts.
Step 2. Make sure the web server can write to your .htaccess file.
The .htaccess file is located in each directory that requires overrides for either URL rewriting or authentication. For WordPress, the one we are interested in is located in the WordPress base directory. That’s the directory that contains the wp-config.php file.
To verify the web server can make changes to this file, login to your WordPress admin page and change your permalink structure to the default. Next, login to your shell account and run the more command against the .htaccess file. The file should contain nothing between the begin and end WordPress comments like so:
#BEGIN WordPress
#END WordPress
Then, change the permalinks back to the custom link structure you want to use and re-read the .htaccess file. It should look something like this:
# 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
If the contents between the #BEGIN and #END comments didn’t change when changing the permalinks, then you may have an issue with file permissions.
If you are not running suPHP or some other method that changes the identity of the web server process to the user that owns the file, you will need to change ownership of the .htaccess file so the web server can write to it. The easiest way to do this is to run a chown command that makes the .htaccess file group owner the same as the web server’s group. Also make sure that the file permissions are set to group r+w when using this technique.
Step 3. Are directory overrides allowed?
Should steps #1 and #2 fail to fix your issue, the final step is to verify that overrides are allowed in the directory containing the .htaccess file. You can make all the changes you want to your .htaccess file, but if your Apache directives aren’t allowing overrides, nothing will happen.
Check the configuration of your virtual server for the AllowOverride directive. It is located under your virtual server configuration in the directory definition section. For example, if your blog is located under /home/jdoe/public_html, your configuration should look like:
<Directory /home/jdoe/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
If AllowOverride None is configured, then that’s your problem. Change it to AllowOverride All and restart the web server process.
If your site works when configured to use the default WordPress permalink structure, but returns 404 page not found errors when configured to use any of the other permalink methods, most of the time the issues can be traced back to one or all of these three simple configuration options.