;

Relocation of a site to another domain: how to do it right

30.06.2020
30.06.2020

A domain is the address of a resource on the network at which it is registered and visible in the search. If necessary, it can be changed. The situations in which website relocation is required are different: changing the name of the company or domain zone, the need to remove projects from the filter (an extreme case, if other measures don’t help). A logical question arises: is it possible to relocate without risks for positions and traffic losses? In fact, yes, this option can be implemented, and we will tell you how to do it.

Step-by-step instruction

Relocation of a website site to a domain is performed in two stages:

  1. Database movement (DB).
  2. New URL redirection configuration.

Tip: before relocating a site to a new domain, you should save the database (backup). In case of unforeseen situations, this measure will help to restore it without loss.

Database Movement Features

You need to move the database very carefully, the correctness of this procedure depends on whether the data can be saved and how correctly it will be displayed after site relocation. If the hosting remains the same in doing this, then you can put the matter into the hoster’s hands. In certain situations, this step won't be necessary, provided that the database is bound to the account. But if you plan to change the hosting, then you need a database dump.

Here is an example of how to relocate a site to a new domain on WordPress:

  1. Database backup through hosting tools. You can also set the necessary commands in the SSH address bar:
  2. Dearchiving:
  3. Tables export from WordPress to SQL:
  4. Replacement of the following lines:
  • cd full_path_to_WP//jump to the folder from WordPress;
  • tar-pczf backup.tar.gz*//archiving all files in a directory.
  • tar-xvfz backup.tar.gz.
  • transfer of Dump.sql to a new database;
  • amending wp-config.php in the main web resource directory.
  • define(‘DB_NAME’, ‘you_bd_name’);//DB name;
  • define(‘DB_USER’, ‘you_db_user’); //DB user;
  • define(‘DB_PASSWORD’, ‘you_db_password’); //password for DB;
  • define(‘DB_HOST’, ‘you_db_host’); //DB host хост.

With that, relocation is almost over, the site may already be available on the new domain. Sometimes links may not work correctly, so you will need to enter a special code in phpmyadmin to replace old links. If everything went well, then you can proceed to the 2nd stage.

Relocation to another URL

At the 2nd stage, the site is redirected to a new address. This measure is not only useful for visitors but also helps search engines find out about resource relocation so that they no longer index the old site. This can be done by performing the following operations:

  • .htaccess editing;
  • rewriting engine on;
  • rewriting cond% (HTTP_HOST)^old site.com;
  • rewriting rule (.*) http://new site.com/$1 (R301, L).

Further in the Webmaster’s personal account, you need to configure the settings to inform the search engines about the relocation of the resource to a new address. If the settings are made correctly, then within 30 days everything will be done.

To conclude, we note that relocating a website to another domain with full preservation of the link mass and traffic is a time consuming but not difficult task that can be completed independently. The main thing is to save a backup copy of the database and correctly perform all stages of the procedure.

 

Share
Share
Previous news
Next news