Some posts returning 404 instead of displaying post

I’m having a problem with my WordPress install. All of a sudden some of my posts return 404 errors when I try to go to their permalink. My post names are all numbers and this started happening when my numbered posts went over 1000.

So for example, this post works correctly:
http://kidlolly.com/post/999/

Read More

But this one returns a 404:
http://kidlolly.com/post/1000/

Any clue what might be the root of the problem? I am suspect maybe my .htaccess file but I admit I am not super savvy on .htaccess so I’m not quite sure what to look for. I am running a few “security” plugins that affect the .htaccess but since it isn’t a problem for posts 1-999 I am not sure what to look for.

Here’s where I think the problem might be in .htaccess file (if that is indeed the case), anyone able to help me interpret it?

    RewriteCond %{QUERY_STRING} ../ [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(bash|git|hg|log|svn|swp|cvs) [NC,OR]
    RewriteCond %{QUERY_STRING} etc/passwd [NC,OR]
    RewriteCond %{QUERY_STRING} boot.ini [NC,OR]
    RewriteCond %{QUERY_STRING} ftp:  [NC,OR]
    RewriteCond %{QUERY_STRING} http:  [NC,OR]
    RewriteCond %{QUERY_STRING} https:  [NC,OR]
    RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
    RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR]
    RewriteCond %{QUERY_STRING} base64_encode.*(.*) [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*([|]|(|)|<|>|ê|"|;|?|*|=$).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*("|'|<|>|\|{||).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F|127.0).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]
    RewriteCond %{QUERY_STRING} ^.*(request|select|concat|insert|union|declare).* [NC]
    RewriteCond %{QUERY_STRING} !^loggedout=true
    RewriteCond %{QUERY_STRING} !^action=rp
    RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
    RewriteCond %{HTTP_REFERER} !^http://maps.googleapis.com(.*)$
    RewriteRule ^(.*)$ - [F,L]

Thanks in advance!

Related posts

Leave a Reply

1 comment

  1. As I mentioned in my comment, the date rewrite rule is picking up your post permalink and trying to load a year archive instead of your single post. Since it appears you don’t use date URLs on your site, you can change the date structure so it no longer clashes. Add this to your theme’s functions.php file, then visit the Settings > Permalinks page in Admin to flush the rewrite rules:

    function wpa82820_date_structure(){
        global $wp_rewrite;
        $wp_rewrite->date_structure = 'date/%year%/%monthnum%/%day%';
    }
    add_action( 'init', 'wpa82820_date_structure' );
    

    This changes date URLs from /2013/01/23/ to /date/2013/01/23/ so they no longer clash with 4 digit single post permalinks.