Reputation: 11
I have canada website, have two version of website ca.domainname.com
and canada.domainname.com
. I want 301 permenant rediret ca.domainname.com
all website to canada.domainname.com
through htaccess.tried below code
RewriteCond %{HTTP_HOST} ^CA\.domainmae\.com$ [NC]
RewriteRule ^ http://canada.domainmae.com [L,R]
Upvotes: 0
Views: 879
Reputation: 12469
Changing
RewriteCond %{HTTP_HOST} ^CA\.domainmae\.com$ [NC]
RewriteRule ^ http://canada.domainmae.com [L,R]
to
RewriteRule ^(.*) http://canada.domainmae.com [L,R=301]
should work. Put that in the htaccess file in te root folder of ca.domainmae.com
If you want to be redirected to the corresponding url on the new website you can use:
RewriteRule ^(.*) http://canada.domainmae.com/$1 [L,R=301]
Upvotes: 1