How do I move Wordpress from one location/domain to another?

Step 1: 
Copy the entire contents of the old domain folder, which includes your entire WordPress blog, into the brand new domain folder. 
 
Step 2: 
Next, there are a couple of SQL statements that you need to run:

A: First, to update your WordPress options with the new location of your blog, the following SQL command needs to be put in:
 
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
 
B: Next, you are going to need to fix the URLs of your posts and pages on WordPress. The URL values are stored as absolute URLs rather than as relative URLs, so you need to use the following SQL query to change them.
 
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
 
C: If you have linked internally at any point within your blog posts or your pages using absolute URLs, then this links are going to be pointing to the wrong locations after you change the location of your blog. You need to use the following SQL commands in order to fix all of the internal linking in all of your WordPress posts and pages.
 
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
 
Once you have put all of these SQL queries into action, the next step is to browse through as much of your WordPress blog as you can in order to make sure that everything is in good working order. You are also going to need to login to your WP Administration section because the authentication cookie will become invalid when you change domains.
 
Now you can delete the old folder contents so that your blog is not appearing in two different places.
 
Step 3: 
 
In order to 301 redirect all old links from the old domain to the new domain, place a single file .htaccess into the now empty folder. You want to be sure to 301 redirect else you will permanently lose any hard earned links you have developed. Here is what the file should contain:
 
RewriteEngine on
RewriteCond %{HTTP_HOST} ^.old-domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.old-domain.com
RewriteRule ^/?(.*)$ "http://www.new-domain.com/$1" [R=301,L]
 
Step 4: 
 
Finally, update your WordPress blog to have the new blog name in your title.
 
The process is relatively simple once you have a feel for what needs to be accomplished. Above all else, it is vital that you avoid upsetting your linking structure in the process. Make sure that all of your links are still valid and working after you make the big move, and your blog should be just fine, and more importantly, better off with an improved domain name
Was this answer helpful?

Related Articles

Why does Google say my site contains malware?

(WORK IN PROGRESS!)So you've gotten a few calls, emails, drop-in visits with some frantic current...

Activating WordFence Extended Protection

WordFence Auto Sense Firewall (images to come!) An issue has been identified with a Wordpress...

How To Change Your WordPress Login URL

How To Change Your WordPress Login URL The short answer is to install, activate, and configure...

How to Prevent Brute Force Attacks on Your Wordpress Install

Unlike hacks that focus on vulnerabilities in software, a Brute Force Attack aims at being the...

How to Allow Your IP Address Access to Wordpress - htaccess

If you would like to limit access to your Wordpress Login script to only specified IP Addresses,...