How to properly migrate a Wordpress site to another domain
You have decided to move your WordPress site to a new domain. Whatever the reason, there is a possibility that something will go wrong in the transfer process. You may lose content, the functionality of the site may be impaired. This simple guide will help you move your WordPress site to a new domain name safely and without losing SEO rankings. If you want to transfer your Wordpress site to our hosting, just order the transfer service for free.
Moving a working WP site to a new domain
Before you start the transfer, do not forget to specify in the settings of a new domain DNS-servers for your hosting. At TutHost this:
- ns1.tuthost.com;
- ns2.tuthost.com.
The most important step before starting the transfer – make a backup of the database. If something goes wrong, you can recover the data, so never neglect this step. You can make backups with numerous plugins for Wordpress: UpdraftPlus, Backup Guard, Total Upkeep and others.
You can also do the work manually by going to the desired database and selecting “Export” in the menu. On the tab that opens, find “Export Method” and select “Quick” Under “Format” specify SQL. Click “Go” and save the database dump in .sql format.
When a backup is made, connect to the server via FTP and copy all files and folders from the directory with the name of your domain to your local computer.
The transfer can be done in 3 different ways. Note that the transfer to a new domain does not require the transfer of files, if you stay with your current hosting provider. By the way, transferring a domain for service in TutHost is very easy.
Option #1. The easiest, suitable even for “dummies”
This method is suitable for anyone who knows how to use the admin engine WordPress. Follow a few steps:
- Go to the “Settings” menu, then select “General”.
- Find the “Blog Address” and “WordPress Address” fields. Replace the old domain with a new one. Save the settings.
If all went well, you will be redirected to the login pages to log in again. The URL will contain the new domain name.
Option #2. Average difficulty
In the preparatory stage, you saved the database dump in .sql format. Open the file in a text editor with syntax highlighting of programming languages (for example, Visual Studio Code, Sublime text, Notepad++, Atom).
You need to replace all references to the old domain with the new one. The AutoReplace feature will help you do this quickly. Save the changes.
Now it remains to upload the updated dump to the server via FTP. The site will now run on the new domain.
Option #3. For “advanced” users
Users who are familiar with SQL databases and phpMyAdmin can perform the migration from the database. Follow the instructions:
- Go to phpMyAdmin and select the base with your site.
- Enter 3 queries in sequence. Instead of ‘http://old-domain.com’ and ‘http://new-domain.com’ specify your old and new domain respectively.
Queries to be entered:
1. UPDATE wp_options SET option_value = replace(option_value, ‘http://old-domain.com’, ‘http://new-domain.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’.
2. UPDATE wp_posts SET guid = replace(guid, ‘http://old-domain.com’, ‘http://new-domain.com’).
3. UPDATE wp_posts SET post_content = replace(post_content, ‘http://old-domain.com’, ‘http://new-domain.com’).
That’s all, now the site on the WP engine is running on the new domain. In order not to lose positions in SERPs, do not forget to configure 301 redirect on the old domain.
The subtleties of setting up a 301 redirect on the old domain
When the old domain is replaced with the new one, the old URL may still show up in search results, other sites may link to it, and it may be added to bookmarks. Anyone who visits the old URL will be taken to a 404 page. 301 redirect allows you to direct users to a new domain, as well as save the resource ranking in search engines.
Setting up a 301 redirect is very simple: find the .htaccess file in the root directory of the site and add these lines:
RewriteEngine on
RewriteCond %{HTTP_HOST}^www.old-domain.com$
RewriteRule (.*)$ http://www.new-domain.com/$1 [R=301, L]
Remember to replace www.old-domain.com and www.new-domain.com with your domain names. Redirect will not work if Apache ModRewrite module is not enabled on the server – check this with your hosting provider, if after editing .htaccess the changes did not take effect.
How to save PR site when moving to a new domain?
Google PageRank (PR) is one of the methods that Google uses to determine the relevance and importance of a page. To keep the PR of the site, Google needs to know that you moved the WP site to a new domain. You can notify the search engine in the Google Search Console. Use the Change Address tool in your account. You will need to confirm ownership of the domain.
After setting up 301 redirects and updating the address in Google Search Console, your resource on the new domain will retain PR, and Google will not lower it in search results.
After the transfer, you only need to check the functionality of plugins and links, connect an SSL-certificate. And if you need another website, we have a handy builder with several hundred templates.