admin管理员组

文章数量:1404337

I'm in the process of changing my web host. I'm wondering about the cleanest way to migrate my WordPress blog. I'm far from being a WordPress expert, I only use it to publish a few posts. Could you say me if my way to process is correct ?

  1. I downloaded all my website and blog content on my hard drive
  2. I exported a .sql of WordPress database restoration script from PHPMyAdmin
  3. I uploaded all my website and blog content on the new web host
  4. I executed the .sql script to create the same database
  5. I updated the wp-config.php WordPress file to update this section:
<?php
/**
* @package WordPress
*/
define('DB_NAME', 'THE_NAME_OF_DATABASE');
define('DB_USER', 'THE_DB_USER');
define('DB_PASSWORD', 'THE_DB_PASSWORD');
define('DB_HOST', 'THE_SQL_ADRESSE');

Currently , my WordPress seems running perfectly. Modules are correcly installed. The only parameter I can't say if it will work correctly is the wp-admin.php access. Indeed, as I transfere also my domain on the new web host, I am on a temporary cluster domain name so when I connect me to the administration panel, I am redirected to the real domain (old webhost). I will be fixed in several days.

I'm in the process of changing my web host. I'm wondering about the cleanest way to migrate my WordPress blog. I'm far from being a WordPress expert, I only use it to publish a few posts. Could you say me if my way to process is correct ?

  1. I downloaded all my website and blog content on my hard drive
  2. I exported a .sql of WordPress database restoration script from PHPMyAdmin
  3. I uploaded all my website and blog content on the new web host
  4. I executed the .sql script to create the same database
  5. I updated the wp-config.php WordPress file to update this section:
<?php
/**
* @package WordPress
*/
define('DB_NAME', 'THE_NAME_OF_DATABASE');
define('DB_USER', 'THE_DB_USER');
define('DB_PASSWORD', 'THE_DB_PASSWORD');
define('DB_HOST', 'THE_SQL_ADRESSE');

Currently , my WordPress seems running perfectly. Modules are correcly installed. The only parameter I can't say if it will work correctly is the wp-admin.php access. Indeed, as I transfere also my domain on the new web host, I am on a temporary cluster domain name so when I connect me to the administration panel, I am redirected to the real domain (old webhost). I will be fixed in several days.

Share Improve this question asked Jan 25, 2020 at 12:12 AnonymousAnonymous 1012 bronze badges 1
  • 3 My opinion is that you are on the right way, but you will need also to change the site and home url (if you've changed the domain name). This can be easily done through phpMyAdmin(for example). You will need to locate wp_options table and search for siteurl and home option_name and change it to the new domain name. – AnTrakS Commented Jan 25, 2020 at 12:23
Add a comment  | 

2 Answers 2

Reset to default 1

It would seem you have covered all your bases and your site is working as it should.

An additional step I have found useful is to verify hard coded paths within your exported SQL file because problems might not appear for weeks after the move.

I have moved a sites a few times and it seemed to be working fine, but after a few weeks I noticed some images were not appearing. My site had previously been http and I had moved to https for additional security. Some of the plugins used would save an image location into the database as http://example/wp-content/blahblah and that was incorrect.

If I ever move my site I always search the exported text, using a text editor, for http://example and replace with https://example. I also check if file paths have changed such as /doc/mydomain/public_html might because /var/sites/mydomain/public_html.

Having your site in text format gives you an opportunity to globally replace various things :)

That fixes any items hard coded by badly written plugins. It also takes care of the Wordpress Home & URL items as mentioned by D.Dimitrov in the comments.

I hope this helps you and others who might stumble across this.

My domain is now pointing the new web server host. All seems works perfectly. I can execute WordPress plugin update, my image appears... I precise that I don't change the domain name and my site was already in HTTPS. So to resume, this is the steps to migrate a WordPress :

  1. Download all my website and blog content on my hard drive
  2. Export a .sql of WordPress database restoration script from PHPMyAdmin
  3. Upload all my website and blog content on the new web host
  4. Execute the .sql script to create the same database
  5. Update the wp-config.php WordPress file to update the section DB_NAME, DB_USER, DB_PASSWORD, DB_HOST

本文标签: databaseIs my way to change WordPress server is correct