Welcome to WebmasterWorld Guest from 184.73.112.180

Forum Moderators: Ocean10000 & incrediBILL & phranque

subdomain error

500 errors with subdomain wpress installation

   
6:32 am on Nov 22, 2009 (gmt 0)

10+ Year Member



Hi -
I have many 500 errors when the URLs show a specific file - EG, subdomain.example.com/folder/file.php, but not with the bare URL, EG, subdomain.example.com/

Example.com/subdomain/folder/file.php also resolves OK.

I have tried rewriting the URL from subdomain.example.com to example.com/subdomain/
ie,
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^subdomain.example.comt(.*) [NC]
RewriteRule ^(.*)$ http://example.com/subdomain/$1 [R=301,L]
I have downloaded/tried various other forms of subdomain redirect unsuccessfully too.
Any ideas please?

3:24 pm on Nov 22, 2009 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I have tried rewriting the URL...

No. You have redirected requests for one URL, such that the browser is advised to make a new request for a new URL. Rules with either a domain name in the target and/or the [R] flag are redirects.

The stuff in bold is NOT required:

^subdomain\.example\.com[b]t(.*)[/b]

and you should escape the literal periods.
5:01 pm on Nov 22, 2009 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Either way you code it --as an external redirect or as an internal rewrite-- the problem is the same: You've got an 'infinite' loop there.

Since it it usually desired to use an internal rewrite to 'map' subdomain requests to a subdirectory, here' one way to fix it:


Options +FollowSymlinks
RewriteEngine on
#
RewriteCond %{HTTP_HOST} ^subdomain\.example\.com [NC]
RewriteCond $1 !^subdomain/
RewriteRule ^(.*)$ /subdomain/$1 [L]

Here the new RewriteCond prevents the rule from being re-invoked if the requested path already starts with "subdomain/" and so prevents recursion (looping).

Note: When you get a 500-Server Error, the first place to look is in your server error log file. The information in that file often indicates the exact problem, or at least gives a strong clue... In this case, you will find "Request exceeded the limit of <number> redirects due to probable configuration error." or some-such, pointing you to an error in your configurations files -- e.g. .htaccess code.

Jim

2:15 am on Nov 23, 2009 (gmt 0)

10+ Year Member



Thanks Jim.

There are no 500 errors showing on the CPanel error log - where else should I have looked for them?

2:47 am on Nov 23, 2009 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I'm not sure, because I don't use cPanel-type hosting. I just look at my raw server access and error log files.

Also, be aware that in that type of set-up, it's common for the host to flush the error the log file, usually on a daily basis. So you might have to re-create the errors to see a 'fresh' error log entry.

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month