Logo Weblocation Website creation

How to redirect domain using htaccess

How to redirect domain using htaccess

If you have two domains and want to drive traffic to just one main domain without losing links. The simplest and fastest way is to insert the following code in the .htaccess file of your old domain.

Follow code below:

RewriteEngine on RewriteCond %{HTTP_HOST} ^old-domain.com.br$ [OR] RewriteCond %{HTTP_HOST} ^www.old-domain.com.br$ RewriteRule ^(.*)$ http://www.primary-domain. com.br/$1 [R=301.L]

Just replace the terms old-domain by the domain that will be directed and the main domain for your new domain, which will receive the redirect htaccess.

And that's it!

Need help?