How to redirect old domain to new domain [Step by Step]

0
25

How to redirect old domain to new domain [Step by Step]

Domain is a foundation of your online business. while choosing your online business you have to select the domain based on the keywords. But sometimes we need to change the domain name, from one to another. Such a condition we have to redirect all the traffic from our old domain to new domain. This is tutorial we are going to see how to redirect one domain to another domain without losing your traffic.
Generally, redirection can be classified as permanent direction (301) and temporary redirection (302).

302 redirections:

302 redirections are called as temporary redirection. The search engine temporarily indexes your new changing URL. It can be done by either using server or plugins. This redirect doesn’t carry or pass the link value to the new location. What it does do is get the user to an appropriate location for you so that you aren’t showing them a broken link, a 404 page not found, or an error page. For WordPress you can use this redirection plugin. 302 redirect tells the search engine the content is temporarily not available therefore search crawlers keeps the same rank to the old URL.

301 directions:

The search engine is permanently considered the change url, i.e if you have example.com, now you are changing to example.net means, the search engine considers your new URL only. It indexes your new URL. For wordpress website you can go with this simple 301 redirect pluin. i.e for redirecting from one domain to another domain. .httacces method will be very useful. Let see the 301 redirection using .httaccess method.
  • Go to your domain c-panel which domain redirect to another domain
  • Then go to file manager => access public .html folder => search. httacess file. => click on edit => add the below mentioned code.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.net/$1 [L,R=301,NC]
  • Save it.
Now all of your old domain will be redirected to new domain.
Note: Never forget to change example.com => your old domain and example.net => new domain. Also if you have aleady “RewriteEngine on” code means you just remove the RewriteEngine on code from above and add it.
For redirecting non www to www then add below mentioned code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC]
For redirecting non existing pages to some other particular pages means add below mentioned code:
Options +SymLinksIfOwnerMatch
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Thank you..

LEAVE A REPLY

Please enter your comment!
Please enter your name here