WordPress.org

Ready to get started?Download WordPress

Forums

Permalinks problem - 404 error code for directories outside WP installation (1 post)

  1. zezepedro
    Member
    Posted 7 years ago #

    --------------
    Our scenario:
    --------------

    Server: WP 2.1.2, Apcahe2 with mod_rewrite enabled and running virtual hosts.

    http://www.example.com :: DocumentRoot /var/www/example.com

    WordPress is installed in /var/www/example.com/blog

    -----------------------------------------------------------
    Wordpress Address - http://www.example.com/blog
    Blog Address - http://www.example.com/blog (also)
    -----------------------------------------------------------

    So our site file structure looks like this under /var/www/example.com/:

    --------------------------
    index.php (the main file)
    services/index.php
    about/index.php
    contact/index.php
    (... 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/example.com. So we have this in our root index.php file:

    require("blog/wp-blog-header.php");

    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 http://www.example.com/blog 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 http://www.example.com/blog/2007/06/post-title it goes to the respective single page. No problem so far!

    ----------
    PROBLEM
    ----------

    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/example.com 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: http://gsitecrawler.com/tools/Server-Status.aspx) to see what's in the headers we see a 404 error. For example if we put http://www.example.com/blog or http://www.example.com, it returns 200/OK but if we put http://www.example.com/services it returns 404 and google does not indexes it.

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

    require('../blog/wp-blog-header.php');

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic