Last night, I getting lots of 404 error while using Google to search my own blog index page, I realized there is something wrong about my blog.

My user-created-outside-of-WP folder is throwing a 404 when trying to access it. Now for some details:

Blog www.moon-blog.com : normal WP blog. Permalinks “/%year%/%monthnum%/%postname%.html” through mod_rewrite in the default .htaccess file WP created.

Subdirectory www.moon-blog.com/MySubdirectory/): normal PHP application. User defind permalinks. Located at directory “/MySubdirectory/”.

The problem is that the WordPress thinks My Subdirectory is 404, and do not allow Google to index my files.

I Try add some of php code into my php application to resolve this problem:

header("Status: 200 OK");

After adding that code, my PHP application in the subdirectory do not return 404 error again.

Related posts


Comments

11 Responses to “WordPress Mod Rewrite Make Subdirectory 404 Error”

  1. Jason Coleman on February 15th, 2008 7:45 pm

    Thank you very much. I was struggling with this for a few hours.

    I have a Wordpress plugin that adds some mod rewrites to redirect certain urls (like “/products/product1″) to a file in the plugin folder. IE6&7 were giving me random 404 errors… usually when I tried to refresh while the page was still loading.

    Anyway, adding the header 200 OK code to the top of the PHP scripts fixed it.

    This is a really weird fix. Shouldn’t PHP be sending 200 status by default anyway?

  2. Jerry on March 31st, 2008 6:38 pm

    Wow. That did work. Thanks so much for sharing this! The 404s were driving me nuts.

  3. Pashalex on April 9th, 2008 5:38 pm

    I am trying to install a new theme in word press 2.0 but any theme i chose it comes up with an error “Broken Theme” and “style.css is unreadable”.
    Any comments much appreciated.

  4. FMS GROUP on July 28th, 2008 2:49 pm

    Wow. That did work. Thanks so much for sharing this! The 404s were driving me nuts.

  5. The 404 problems of WordPress subdirectory Rewrite : LOVE BLOG on September 19th, 2008 4:23 am

    [...] English edition: WordPress Mod Rewrite Make Subdirectory 404 Error [...]

  6. dell80 on October 24th, 2008 6:33 am

    which php document did you insert the line of code into?

  7. Muhammad Ali on November 2nd, 2008 11:11 pm

    Hi, on my wordpress, i have searched a lot, but not found any .htaccess file there, please tell me how wordpress do mode-rewite.

  8. Moon Blog » The 404 problems of WordPress subdirectory Rewrite on November 29th, 2008 7:28 pm

    [...] edition: WordPress Mod Rewrite Make Subdirectory 404 Error [...]

  9. E-Construir on November 30th, 2008 9:47 pm

    mmm… I believe that that should solve it the WP without mediation on our behalf. To my I found difficult to get the answer. (yo creo que eso lo deberia resolver el WP sin mediacion de nuestra parte. A mi me costó muchas horas conseguir la respuesta)

  10. Ivan | Irish Blogger on March 31st, 2009 12:32 pm

    Can two WordPress installations run under a same domain? One in the root and the other in the /blog/ directory? I have the one installed in the root, and not when I try to install the second one - that is in the /blog/ I get an 404 error from the first (root) one.

    Can I install the two somehow?

    Where exactly would I put:
    header(”Status: 200 OK”);

  11. Wordpress 2.7 Released « BLOGCHINA.ME on April 1st, 2009 11:02 pm

    [...] WordPress Mod Rewrite Make Subdirectory 404 Error (10) [...]

Leave a Reply