Reputation: 495
I have a .htaccess related question.
For example, if I have two domain, a.com and b.com. All referring to one host (b.com is domain alias of a.com). I want visitor that visit a.com will be referred to url with www (http://www.a.com). As for the visitor of http://b.com will be referred to the www url (http://www.b.com).
How can I do this with .htaccess??
Thanks, any help will be much appreciated :)
Upvotes: 2
Views: 2296
Reputation: 123841
You could try with 2 rewrite rules
RewriteEngine On
RewriteCond %{HTTP_HOST} ^a\.com$ [NC]
RewriteRule ^(.*)$ http://www.a.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^b\.com$ [NC]
RewriteRule ^(.*)$ http://www.b.com/$1 [L,R=301]
Upvotes: 5