.htaccess redirect domain alias / parked domain

I have a question related to .htaccess.

For example, if I have two domains, a.com and b.com. All links to the same host (b.com is the domain alias a.com). I want a visitor to visit a.com site to link to the url from www ( http://www.a.com ). For the visitor to http://b.com , the URL www ( http://www.b.com ) will be passed .

How can I do this using .htaccess?

Thanks, any help would be greatly appreciated :)

+2


a source to share


1 answer


You can 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]

      

+5


a source







All Articles