views:

77

answers:

1

Hi...

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 :)

+1  A: 

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]
S.Mark
hey... thanks. It's working now :)
Calua