Not sure when it happened but the custom permalinks for pages on my client's Wordpress site have broken. I can fix it by reverting back to the default permalinks and then using the custom permalinks, but they break again whenever my clients edits a page. Blog posts, archives, tags, categories, and custom post types permalinks all work fine, it's only pages that 404 when using custom permalinks.

The site has an .htaccess file with 666 permissions with the following in the file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

It also has mod_rewrite enabled.

Using Wordpress 3.1.3

It's not the plugins because I have disabled all of them and the permalinks for pages still don't work.

Please help.

  • 1
    I would recommend not using 666 as a file permissions, especially if there are other users on the same server. Also rename the .htaccess to old.htaccess and click default permlinks, then click your custom structure 2x, then check if WordPress has written a new .htaccess and compare it to the old one.
    – Wyck
    Jun 18, 2011 at 3:23
  • @Wyck I generated new .htaccess several times by doing what you said. It still 404's when I edit a page and the .htaccess file has the same code in it. The .htaccess file is currently 644. Jun 18, 2011 at 20:09
  • Does the same thing occur with the default twentyten theme and all plugins disabled?
    – Wyck
    Jun 19, 2011 at 1:43
  • It works fine in the TwentyTen theme with all plugins enabled (didn't try disabled). That means there is something wrong with the theme then doesn't it? Any idea what could cause this? Jun 20, 2011 at 22:36
  • It's impossible to say, try contact the theme author, if you have to start looking in functions.php for anything weird.
    – Wyck
    Jun 21, 2011 at 16:11

3 Answers 3


Do you have a custom post type? This is exactly the kind of behavior you will see from have a custom post type with a slug that matches the slug of your pages. For example, if you have a page called "portfolio" and a post type called "portfolio", both with a slug of "portfolio", 404s are going to be thrown for some of these.


I was using the Custom Post Type UI Plugin and had generated the following code (which I added to the functions file) for a custom taxonomy through the plugin:

register_taxonomy( 'video_type',
    array ( 0 => 'video' ),
        'hierarchical'    => true,
        'label'           => 'Type',
        'show_ui'         => true,
        'query_var'       => true,
        'rewrite'         => array( 'slug' => '' ),
        'singular_label'  => 'video_type'

Somehow that code broke the theme. In Custom Post Type UI you can either create custom posts types and taxonomies and keep the plugin active or use the beta function to copy and paste generated code to your function file. So I ended up deleting that code and keeping the plugin active.


This happened to a client's Wordpress installation after a malicious attack. The .htaccess file had been tampered with and the theme's functions.php had a new obfuscated function at the top of the file.

Reverting to the standard .htaccess file and removing the offending function fixed the problem for me.

(Of course, that's not to say other files were not compromised.)

Your Answer

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

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