Support » Fixing WordPress » Permalinks problem – 404 error code for directories outside WP installation

  • ————–
    Our scenario:

    Server: WP 2.1.2, Apcahe2 with mod_rewrite enabled and running virtual hosts. :: DocumentRoot /var/www/

    WordPress is installed in /var/www/

    Wordpress Address –
    Blog Address – (also)

    So our site file structure looks like this under /var/www/

    index.php (the main file)
    (… and)
    blog/(all wordpress files here)

    In the root index.php file of our site (not wordpress) we include wordpress wp-blog-header.php file to be able to use wordpress functions throughout our site files in /var/www/ So we have this in our root index.php file:


    And it works just fine. We are able to use all wordpress built-in functions and use it as a CMS for our site. And when we go to it displays our blog custom theme files. Perfect!

    We have also enabled pretty permalinks and written the respective .htaccess file under the blog/ directory. This is also working just fine, so when we put it goes to the respective single page. No problem so far!


    Our site is working ok… when is seen on a browser. But when search engines like google try to index our pages, they can only do that for our site root index.php file and for the files under blog/.

    For all other site directories under /var/www/ a 404 error code is returned in the headers (although a normal browser displays the pages correctly).

    When using those tools available in the Internet (ex: to see what’s in the headers we see a 404 error. For example if we put or, it returns 200/OK but if we put it returns 404 and google does not indexes it.

    In the index.php files on those directories we also include wordpress like this:


    The strange thing is that if we disable pretty permalinks and switch to the default (…/?p=23) that pages get indexed and no 404 error is returned. And even if we disable mod_rewrite in Apache, just the simple fact of activating permalinks in WP, results in all those other pages returning 404 in the headers again.

    We are using lynx to see this strange behaviour happening.

    Has anyone experienced similar problem?

    If you need more details just let me know.

  • The topic ‘Permalinks problem – 404 error code for directories outside WP installation’ is closed to new replies.