Mobile app version of vmapp.org
Login or Join
Martha676

: Mod_rewrite problems - redirect subdomain to different domain I must have a brain freeze as I can not get my rewrite rules working. RewriteEngine On RewriteCond %{HTTP_HOST} ^otherdomain.example.com

@Martha676

Posted in: #Apache #ModRewrite

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 ^(.*) www.otherdomain.com/ [R=permanent,L]

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


What I want is essential to redirect

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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Martha676

1 Comments

Sorted by latest first Latest Oldest Best

 

@Lee4591628

Just use the below redirection. will work 100%. Because I personally use it for my website....

RewriteCond %{HTTP_HOST} ^subname.old-main-domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.subname.old-main-domain.com$
RewriteRule ^(.*)$ "http://www.newdomain.com/" [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme