3

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
2

6 Answers 6

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

6
  • 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
    Commented Dec 23, 2010 at 20:07
  • I read that; but the first step is to resave your permalinks anyway. Commented Dec 23, 2010 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
    Commented Dec 23, 2010 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. Commented Dec 24, 2010 at 2:14
  • @songdogtech Link only answer. Maybe update this one as it's attracting some readers?
    – kaiser
    Commented Mar 15, 2015 at 12:42
0

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.

0

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

0

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.

0

I had same kind of issue.

  • Make sure Apache rewrite module enabled and proper .htaccess file
  • If above step not working, Go to permalinks settings and enter category base as "category"
  • Some SEO plugins own rewrite may give you issue
  • If you have any cache plugin, clear that.
0

This happened to me after my host migrated to a different server. The answer for me as markratledge stated above was to "resave your permalinks from WordPress admin."

To expand on this in detail:

  1. Log into your Wordpress site.

  2. Click on Dashboard->Settings->Permalinks

  3. Assuming your setting is on "Post Name", select "Numeric" then "Save button".

  4. Now click on the "Post Name" radio button again, and select "Save".

This should re-save your settings and the tags and categories should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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