Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
share|improve this question
    
I don't get any 404 error on blog.rtwilson.com/category/tok-related –  hakre Dec 24 '10 at 2:36
    
Those are normal permalinks, and your categories seem to be working now. –  markratledge Dec 24 '10 at 3:07

4 Answers 4

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

share|improve this answer
    
WP didn't warn me about anything. The permalinks for the blog posts are working fine, it's just the category pages and I didn't change the permalink structure for those! –  robintw Dec 23 '10 at 20:07
    
I read that; but the first step is to resave your permalinks anyway. –  markratledge Dec 23 '10 at 20:10
    
Thanks. I've resaved my permalinks preferences, and checked .htaccess. The .htaccess file has a modified time of the time that I resaved the permalink preferences. I've put the contents of the .htaccess file at the bottom of the question. –  robintw Dec 23 '10 at 20:38
1  
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. –  onetrickpony Dec 24 '10 at 2:14
    
@songdogtech Link only answer. Maybe update this one as it's attracting some readers? –  kaiser Mar 15 at 12:42

Does anyone have any ideas why this might have happened?

I don't get a 404 error on that page, but to answer the question: I have no idea why this happens or it does not happen.

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?

Each time you change the permalink structure in the admin, permalinks get automatically rebuild, so you do not need to care about that. And there is no such thing as rebuilding the category list, so you do not need to wonder about that.

share|improve this answer

I had the same problem - I had installed 'advanced permalinks' plugin, and it has a bug... turns out that commenting out this line

$this->add_filter ('category_rewrite_rules');

in the plugin. Oringal answer not mine (although it worked for me) but was from here

share|improve this answer

I have install "Advance Permalink" plungin by John Godley, on 31st March' 2015 for redirect me previous permalink structure of http://punch2crunch.com

After 36 hours my all cotegories start creating automatically 404 errors and one category working but sick to single post. If this same is happening with you then you have to paste a thing only.

Follow the steps:

  1. From dashboard, Go to plugins, choose editor.
  2. Select "Advance-permalink/Advance-permalink.php
  3. Scroll down till you found below code

    $this->add_filter ('post_rewrite_rules');
    $this->add_filter ('author_rewrite_rules');
    $this->add_filter ('category_rewrite_rules');
    $this->add_filter ('rewrite_rules_array');
    
  4. Simply put two forward slashes // before $this->add_filter ('category_rewrite_rules'); like below

    $this->add_filter ('post_rewrite_rules');
    $this->add_filter ('author_rewrite_rules');
    //$this->add_filter ('category_rewrite_rules');
    $this->add_filter ('rewrite_rules_array');
    

Refresh your site, and everything will start working perfect again. If not then have to find somewhere else.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.