When you migrate a site from one domain to another it is very important to move your traffic from your older domain to new domain. If you don’t take care of that you will lost your traffic and even existance in search engines. It is important that your all pages should be redirected to new domain properly otherwise you will lose your traffic.
There are different ways to redirect an old domain to new domain:
- Via .htaccess
- Via HTML
- Via JS
- Via PHP
- Via server
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^olddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.olddomain.com$ RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L] </IfModule>