Categories
Domains SQL / MySQL Tips and Tutorials WordPress How To

How to Transfer / Move WordPress Blog from One Domain to Another

Basically, the root URL of your blog which is your domain or subdomain is changing here. Though this doesn’t seem like a sane decision considering the huge SEO impact that might fall upon your site but with HTTP 301 permanent redirection, this can still make sense in some situations.

Assume you won’t change the details of the WordPress database connection, then there’d be no need to change or modify any PHP files at all. Just the database tables and related values concerning the URLs.

The idea is to find all table field values containing the string ‘olddomain.com‘ which is your old domain and change it to the new domain ‘newdomain.com‘. Follow me:

  1. Copy all the WordPress PHP program files from the old directory to the new one which the new domain is pointed at.
  2. Connect to WordPress database by phpMyAdmin or plain mysql command or whatever you are familiar with. But this example will only go with phpMyAdmin.
  3. In phpMyAdmin, at the database level, click ‘Search‘ -> ‘Select All‘ -> Search for ‘olddomain.com‘ -> Click ‘Go‘. In most cases, there are just 2 tables that need to be modified accordingly: wp_posts and wp_options.
  4. Click ‘Browse’ to look for records with the string ‘olddomain.com‘ in them.
  5. For ‘wp_options’, edit each record and find all occurrences of the old string ‘olddomain.com‘ and modify it to ‘newdomain.com‘. Click ‘Go‘ to update.
  6. For ‘wp_posts’, you can leave the guid field intact or update it with the new domain string but it doesn’t matter much. The hard part is to update the post content of all posts and replace all occurrences of the old domain string to the new one. You can get all this done by the following SQL query: UPDATE wp_posts SET post_content = REPLACE(post_content, 'olddomain.com', 'newdomain.com')

Now you should be set, fire up your browser and navigate to your blog at the new domain and check everything out to see if it’s working properly.

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.

5 replies on “How to Transfer / Move WordPress Blog from One Domain to Another”

The best solution I have tried so far. However I still have the old domain in the posts/rss feeds. When I put in the SQL query update I get back zero results found.

Any suggestions? This is the only issue to a successful move.

Carol

I have tried this method several times without any problem. Just remember to follow the exact steps to avoid those errors especially that you’re dealing with the database.

Comments are closed.