mod_rewrite problems - redirect subdomain to different domain

Posted by Tom on Pro Webmasters See other posts from Pro Webmasters or by Tom
Published on 2012-04-19T13:45:24Z Indexed on 2013/10/18 10:18 UTC
Read the original article Hit count: 206

Filed under:
|

I must have a brain freeze as I can not get my rewrite rules working.

RewriteEngine On

RewriteCond %{HTTP_HOST} ^otherdomain\.example\.com [NC]
RewriteRule ^(.*) http://www.otherdomain.com/ [R=permanent,L]

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteCond %{REQUEST_URI} ^/otherdomain [NC]
RewriteRule ^(.*) http://www.otherdomain.com/ [R=permanent,L]

What I want is essential to redirect

otherdomain.example.com and example.com/otherdomain to otherdomain.com

© Pro Webmasters or respective owner

Related posts about apache

Related posts about mod-rewrite