Thursday, 5 September 2013

Redirect subdomain, but only if site root requested

Redirect subdomain, but only if site root requested

I can't seem to find an answer to this specific question:
How can I forward http://play.domain.com -- but NOT
http://play.domain.com/xxx
To: http://work.domain.com
Where "xxx" is any string.
In other words, if the user requests the site root, redirect, otherwise
stay on the chosen URL.
I've tried
RewriteEngine On
RewriteCond %{HTTP_HOST} !work.domain.com [NC]
RewriteRule ^(.*)$ http://work.domain.com.com/$1 [R=301,L]
But it's not doing anything :-/

No comments:

Post a Comment