My WordPress blog suddenly seems to have started giving me 404 errors when accessing category pages. For example, http://blog.rtwilson.com/category/tok-related/. Interestingly, this doesn’t happen for child categories (such as GIS and Remote Sensing, shown in the sidebar on the above link) but does happen for parent categories (eg. Academic) and categories with no children (like TOK-related).
Does anyone have any ideas why this might have happened? I recently changed the permalink structure for my blog posts themselves, but not for the categories. Do I need to rebuild the category list somehow? If so, how?
Update
.htaccess file content:
# 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
5 Answers
First thing to try is resave your permalinks from WordPress admin.
And be sure your changes are saved to .htaccess
. if WP warns you that .htaccess
isn’t writable, manually use FTP to change the permissions of the .htaccess
file to 644 and try again.
The “.” in front of the file name means it’s a normally invisible file, so check your FTP client to be sure it will display invisible files if you don’t see an .htaccess
file in your web directory. The .htaccess
file will be at the same directory level as your index.php
file indicated by the Site address (URL) setting on your General Options page.
This is a standard WordPress rewrite block:
# 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 you get a 500 server error, that means the character encoding of the file is wrong and might have been changed when/if you edited the .htaccess file. You can try renaming the current .htaccess file and use your FTP client to create a new file and name it .htaccess.
If you still get 404’s or strange behavior after saving permalinks and seeing that the .htaccess
file has the rewrite block above, try adding
global $wp_rewrite; $wp_rewrite->flush_rules();
in your themes’ functions.php file, go back and refresh the homepage, then remove the code. That will clear out rewrite rules in the cache and in transients.
There are more troubleshooting tips and examples at Using Permalinks « WordPress Codex