Forum Moderators: phranque

Message Too Old, No Replies

.htacess tempredirect except for subdomain?

         

verderacer

4:01 am on Aug 15, 2006 (gmt 0)

10+ Year Member



Ok the guys at my wsp have screwed it up along with it's been some time since I last did this and at this point I just to figure out what I forgot and not getting.

I am trying to redirect the root of my domain except for my subdomain. I thought this would work but its not. It is redirecting my subdomain also. The code is in my .htaccess in my default http directory

RedirectMatch temp ^/$ [thenewsite.net...]

Can anybody tell me what I am missing or forgetting?

Thanks in advance...

jdMorgan

12:31 pm on Aug 15, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mod_alias has no way to test 'the root of my domain except for my subdomain' and therefore, your redirect is unconditional. If the subdomain is hosted on the same server, your code will likely result in an 'infinite' redirection loop -- until the browser or server reaches its redirection limit, that is.

I'd suggest that you use mod_rewrite instead of mod_alias, and use a RewriteCond [httpd.apache.org] to test the HTTP_HOST server variable, so that the rule is invoked only for requests to your main domain's root document and not for requests to your subdomain.

Jim