homepage Welcome to WebmasterWorld Guest from 54.237.98.229
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
subdomain error
500 errors with subdomain wpress installation
Rhys

10+ Year Member



 
Msg#: 4029529 posted 6:32 am on Nov 22, 2009 (gmt 0)

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?

 

g1smd

WebmasterWorld Senior Member g1smd us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 4029529 posted 3:24 pm on Nov 22, 2009 (gmt 0)

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.

jdMorgan

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



 
Msg#: 4029529 posted 5:01 pm on Nov 22, 2009 (gmt 0)

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

Rhys

10+ Year Member



 
Msg#: 4029529 posted 2:15 am on Nov 23, 2009 (gmt 0)

Thanks Jim.

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

jdMorgan

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



 
Msg#: 4029529 posted 2:47 am on Nov 23, 2009 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved