WP in Root, subdirectories give 500 Error. (2 posts)

  1. tommygeorge
    Posted 9 years ago #

    I recently had some trouble on a new GoDaddy server and wanted to share my How To, in case anyone had the same/similar problem. I now know why WordPress should always be installed into subdirectories.

    I have a primary domain hosted, and other secondary domains pointed to subdirectories there. For instance:

    [example.com] is my main site, and [example2.com] points to a subfolder in the directory where the [example.com] files are stored.

    I installed WordPress in the root of [example.com].

    If I directly accesed any files at [example2.com] the correct page would come up, but if I attempted to access files that did not exist (what should give me a 404 error) I received a 500 Server error. This turned out to be problem with the way mod_rewrite was doing it's thing from the root directory.

    Because accessing [example2.com] was the same as typing [example.com/example2.com/index.html]... the rewrite engine would kick in to fix up the URL, since the file wasn't found (on purpose) but didn't have a redirect set up.

    To fix this, instead of reinstalling WordPress in a subdirectory, I added the following line to the TOP of my '.htaccess' file:

    RewriteRule ^(example2.com) - [L]

    Where 'example2.com' was the name of the subdirectory that files for that domain were stored.

    There might be a better way to do this, but that's how I got it working.

    I hope I explained this in at least a slightly understandable way.


  2. TheWanderer
    Posted 9 years ago #

    Hi, I'm facing a somewhat similar problem. My blog used to be in http://blog.soulspider.com and I moved it to the root, so that my blog address is now http://www.soulspider.com. Right now, I'm facing some problems with my search engine results, as I want outdated entries to error 404, instead of error 500 (e.g., http://blog.soulspider.com/index.php should 404, but it currently returns a 500). I need it to 404 so that Google will update its index.

    Now, there's a .htaccess in the root and it has the standard WordPress entries in it:

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

    Should I edit the existing RewriteRule line? I tried adding the line you mentioned to the top of the file, but it still returns a 500.


Topic Closed

This topic has been closed to new replies.

About this Topic