WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 404 pages for more than one wordpress install/site. (3 posts)

  1. csilveira
    Member
    Posted 4 years ago #

    I've looked and found different fixes for this. So I am going to combine all of the things I've found, into one post.

    What my problem was: http://www.mysite.com produced the 404 page that I wanted displayed. BUT a site that is hosted for a client I have is at http://www.mysite.com/othersite and when a 404 page is requested for it the page it displayed with the MAIN site's 404 page.

    What I did:

    * I host my own blog using:
    ********************************************
    * Apache 2.2.14 *
    * PHP 5.2.12 *
    * MySQL 5.1.39 *
    * WordPress v.2.9.2 *
    ********************************************
    This is assuming you have the same setup
    ********************************************
    This is the structure that I have at work. (I don't use sub-domains.)
    http://www.mysite.com <--- (this is the root)
    http://www.mysite.com/othersite <--- (this is the "other" hosted site)

    Each have there own wordpress install but use the same database, with different table prefixs:
    EX: wp_ (for main site) wpsite2_ (for 2nd site)

    In each install root I have a .htaccess file with this code:

    This one is for the main site

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine Off
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    #404 Page
    ErrorDocument 404 /404.html
    # END WordPress

    This one is for the 2nd site:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine Off
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    #404 Page
    ErrorDocument 404 /othersite/404.html
    # END WordPress

    Make sure to have the ErrorDocument handler point to the location of each of your sites 404 page.

    Now this is the lazy way to do it, but I find it effective. When you change a theme you might need to change and edit the page.

    Lastly test out each page, by typing www.mysite.com/THISISATEST and test out your other site www.mysite.com/othersite/THISISATEST

    NOTE
    ****

    Make sure in your httpd.conf file you find and search for the instance of .htacess and edit:

    AllowOverride None switch it to AllowOverride Off

  2. csilveira
    Member
    Posted 4 years ago #

    UPDATE:

    Switching ErrorDocument 404 /othersite/404.html & /404.html with:

    index.php?error=404 for both will call for your themes 404 custom page. This will be a better solution so you won't have to update your 404 every time you change your theme.

  3. csilveira
    Member
    Posted 3 years ago #

    CORRECTION:

    Under NOTE AllowOverride None under the .htacess instance of your httpd.conf file is supposed to be set to ALL

Topic Closed

This topic has been closed to new replies.

About this Topic