I am planning to redirect siteB.com and siteB.net to siteA.com. (siteB.com/.net is an overlay of siteA.com and will have no actual content.)
I want visitors to siteB.com and siteB.net to be redirected to siteA.com in the browser address bar, because the domain names for siteB.com and siteB.net are being phased out and will exist in name only. Existing links out in the wild, however, will continue to need redirects for some time.
Can someone please check my .htaccess rules and see if I got it right?
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^siteB\.(com|net) [NC]
RewriteRule (.*) http://www.siteA.com/$1 [R=301,L]
Thanks
Only suggestion is add a $ at the end of
(com|net)so that it won’t match something like siteB.commerce.com, not that you’d be likely to get requests for that domain. And maybe bound the RewriteRule match to^(.*)$.