I know there are a lot of these issues in the forum but a search didn't turn up anything that fixed my problem. I have a subdomain that has its own domain name, and I want to make sure any requests for the subdomain are redirected to the domain name.
For example, anyone going to sub.domain1.com/page.htm or www.sub.domain1.com/page.htm needs to be redirected to www.domain2.com/page.htm. It needs to work for all requested pages under the subdomain.
This is what I have and it just doesn't work:
I'm not a pro at htaccess rewrite rules -- can anyone help?
Thanks!
For example, anyone going to sub.domain1.com/page.htm or www.sub.domain1.com/page.htm needs to be redirected to www.domain2.com/page.htm. It needs to work for all requested pages under the subdomain.
This is what I have and it just doesn't work:
Code:
RewriteCond %{REMOTE_HOST} ^(.*)sub\.domain1\.com [NC]
RewriteRule ^(.+) %{HTTP_HOST} [C]
RewriteRule ^(.*)sub\.domain1\.com(.*) [URL unfurl="true"]http://www.domain2.com/$2[/URL] [R,L]
I'm not a pro at htaccess rewrite rules -- can anyone help?
Thanks!