How to use .htaccess for Redirection

Recently, when I had a domain change, I needed something in order to transfer all of my traffic from the old domain to the new one. So I used .htaccess for the redirection.

You can also use this, by typing the following in your .htaccess:

RewriteEngine OnRewriteCond %{HTTP_HOST} ^.*oldwebsite\.com$ [NC]

RewriteRule ^(.*)$$1 [R=301,L]

Replace oldwebsite\.com with the current website and replace with the new website URL where you want to redirect the traffic to.

If you want to know what did I used for my old domain, then see below:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^$ [OR]
RewriteCond %{HTTP_HOST} ^$
RewriteRule ^(.*)$ [R=301,L]

Was this post helpful? Follow us on Twitter (@SizzledCore) or become our Facebook fan for all the latest updates!