How to redirect old domain to new domain using .htaccess file

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:

  1. Via .htaccess
  2. Via HTML
  3. Via JS
  4. Via PHP
  5. Via server


<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTP_HOST} ^$ [OR]
  RewriteCond %{HTTP_HOST} ^$
  RewriteRule (.*)$$1 [R=301,L]


Related Posts