WP in Root, subdirectories give 500 Error.
-
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.
Peaces.
- The topic ‘WP in Root, subdirectories give 500 Error.’ is closed to new replies.