Moving a WordPress site from one domain to another

It came about that I needed to move a WordPress website from one domain to another last week. To do this it had to be completed in 3 stages.

1 – Download the files locally of the server and FTP up to the new location
2 – Export the SQL DB and re-create on the new domain with the same details (kep the same name for ease – however you can rename in your WordPress config file). Then import the SQL file you created earlier into this new DB.
3 – Run a couple of updates on your WordPress tables to update the domain names.

Step 1 and 2 should be easy enough to do (if you have installed WordPress already you’ll have the knowledge to do them). Step 3 is a little more tricky and is descrobe below:

You’ll need to update the WordPress options with the new domain location. to do this run the following SQL command (run this in phpmysql or similar mysql program

UPDATE wordpress_options SET option_value = replace(option_value, ‘http://www.your-old-domain-name.com’, ‘http://www.your-new-domain-name.com’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

Then you will need to fix the domain name locations in the posts and pages. Otherwise when you click a link in your newly moved site it will link back to your old domain.

UPDATE wordpress_posts SET guid = replace(guid, ‘http://www.your-old-domain-name.com’,’http://www.http://www.your-new-domain-name.com’);

Now you should be good to go on your new domain.

Share this post
Facebook
Twitter
Telegram
WhatsApp
Pinterest
You may also like
Comments
Latest Products
Featured
Recent posts