1

I am having a site with two domains pointing to the same site. Lets say domain1.com & domain2.com

I want to do a permanent redirect of the domain1.com to domain2.com, so that anyone who visit the site from domain1 even if Google crawler, it should be redirected to the domain2. I want to do this from htaccess. Is it possible?

esafwan
  • 17,311
  • 33
  • 107
  • 166

1 Answers1

1

Yes, it's possible.

put in your .htaccess

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)domain1.com [NC]
RewriteRule ^(.*)$ http://www.domain2.com/$1 [R=301,L]
moskito-x
  • 11,832
  • 5
  • 47
  • 60