How to Move Your Wordpress Site
Ranked #3,411 in Internet, #190,924 overall
How to Move Your Wordpress Site
This is a scary thing to do, but I think you'll find this rather easy to follow and mostly painless! Lots of screenshots, arrows and other things to help make this task easier are included in the guide.
Need to Move Your Wordpress Website?
Let's cut to the chase: you're probably here because either:
- You want to move your Wordpress site to a new folder, such as moving mysite.com to mysite.com/new-location, or,
- You want to move your Wordpress site to an entirely new domain name, such as moving mysite.com to mynewsite.com
Let's be serious for a second, this can seem like a scary thing to do, because there are definitely a few things that will have to be double-checked. If you're doing this move for an old, established website - you'll want to make sure that everything has been done correctly, or you'll have a lot of 404 errors and unhappy visitors on your hands! Let's jump into this and get it over with :)
Moving Wordpress to a New Location
i.e., a new domain name, server or folder
1- Install Wordpress in the new location

- If you're moving Wordpress to a new domain name:
Create your new domain name's account on the server. - If you're moving Wordpress to a new folder within the existing domain name:
Open your FTP program (I use FileZilla - it's the best one out there, and it's free) and create the new folder where your existing Wordpress site will be moved to (see the screenshot on the right).
Once that's done, install Wordpress on the new location where you'll be moving your site to. Download the newest version of Wordpress, put all of the installation files into this new folder, then install it using the "Famous 5-minute installation guide."
During this process, you'll have to create a new database for the website. This is done through MySQL, an option in your webhosting panel (if this is not an option, or if your webhost doesn't offer it - which is rare - you're not going to be able to do this without their help). Create a brand new database as the instructions tell you to do. Don't forget to create a database user, set it to "All Privileges," and then add the database user to the database - this is a commonly overlooked step that will disable you from doing anything from this point forward! Anyway, I'll call this database "mysite_newdatabase" for the sake of this tutorial.
This new database will be blank, but later, you'll have to import fields from your old site database into it.
2- Export the old site's database onto your desktop
Now, we're going to save a copy of the old site's database to your desktop (it's good to keep a copy of this somewhere else too - in case something goes horribly wrong!) In order to copy the database, get into your old site's account on the server via cPanel, WMHx or whatever other interface you have:
- Find the area for "phpMyAdmin" and click it.
- On the left hand column, click the name of your database (it's usually "_mydatabase") so that it's selected. The number in parenthesis signifies how many tables the database has in it.
- Click the "Export" tab in phpMyAdmin. In the "Export" section near the upper left hand side, click "Select All" so that everything in the box is highlighted.
- Make sure that the "SQL" radio button is selected as an option underneath that (it's usually selected by default).
- Everything else can be left as-is, since the defaults don't need to be changed.
- Lastly, the "Save as file" option at the very bottom of the screen should be checked. For "compression," choose "none." You can rename the file in the provided box called "file name template," or you can simply right click/rename the file once it's on your computer. Regardless, click the "Go" button on the far bottom right, and save the file to your desktop.
Now that your old site's database is saved to your desktop, go ahead and name it to something else. For the sake of this tutorial, I'll call the database "oldsite.sql."
3- Import the old site's data into the new database

Remember the brand new database you created when you installed a fresh copy of Wordpress within the new directory? I called it "mysite_newdatabase" before. Let's go into that database through phpMyAdmin. Log into it as explained above, but choose that new database's name on the left hand column. Now, it's time to import the old files into that new database:
- Make sure that the new database is selected on the left hand column within the drop-down box, and that it has a (0) next to it, signifying that it is empty.
- Click the "import" tab, and click the browse button to locate the old database .sql file that we saved to your desktop before.
- Click the "Go" button. You should now see a message that says:
Import has been successfully finished, 12 queries executed.
"12" is just a number used for the example, it will display the number of how ever many fields your site had.
4- Input the correct web address in the database fields
We'll manually edit a couple fields in the database, now. First, look for "wp_options" within the new database, which has just been populated with the old site's data. Click it on the list, which is on the left hand column.When you click "wp_options," the screen will bring up the "Browse" tab. You might have noticed familiar data being shown on this screen, including your page title, site URL, admin email, and other config stuff.
Within this "Browse" tab, there are a few places where you'll have to edit references that are pointing to the old URL. So, if you see anything that references "oldsite.com" instead of "newsite.com," you'll want to click the pencil icon in their row (this can be found on the left of the row) and manually type in the correct address on the next screen, then save. Here's a closer look:

It's pretty self-explanatory: simply edit these old URLs and replace them with the new site's URL. I've found that there are usually only two cases where this has to be edited:
- "option id 1: siteurl" (it's usually on the 1st page)
- "option id 40: home" (it's usually on the 2nd page)
5- Global "Find and Replace" of old URL in the "guid" field

Don't let this title scare you...next up is replacing the old URL, which is found in every single Wordpress post. Don't worry though, you can get this done in about 15 seconds...I promise! Click your database name on the left hand column, once again. When the full list of database fields appears, look for "wp-posts" and click it.
You're looking at a list of every single post on your Wordpress site. If you scroll the screen to the right a little bit, you'll see a column called "guid" which lists the URL of every individual Wordpress post. You'll also notice that they're all referencing the old website, and all of them need to be edited!
Click the "SQL" tab at the top of the screen, and you'll find a section entitled "Run SQL query/queries on database." Select and copy the text inside of this box and delete it, then copy and paste the following directly into that box:
UPDATE wp_posts SET guid = REPLACE (
guid,
'http://www.oldsite.com',
'http://www.newsite.com');
...obviously replacing the "oldsite.com" and "newsite.com" examples I've included with their actual URLs.
6- Update wp-config.php

Open your wp-config.php file for the new site, and edit the database name, database username and database user password so that they reflect the correct settings of the new site's database.
- If you're moving Wordpress to a new folder within the existing domain name:
...just remember that you're running a Wordpress installation within a new folder. So, it will have it's own wp-config.php file which only governs the Wordpress installation running inside of that folder!
7- Update the URLs listed in your .htaccess file

Almost there! Now, it's time to do one more simple but necessary step: open the .htaccess file and make sure that it's referencing the correct URLs. This file is found in your root directory, just locate it through your FTP program, save it to your desktop, and open it in Notepad or Wordpad.
All you have to do here is check to make sure that it is referencing the new address where your new site will be found. A common mistake is to move a website, then visit it only to see a 404 error:
Not Found
The requested URL [whatever the old URL is] was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
...because the .htaccess is still pointing to the wrong address! A good last step is to log into your new site's admin panel, visit the "Settings/General" area, and make sure that the URLs inputted in the "Wordpress address (URL)" and "Blog address (URL)" are referencing the new web address and not the old one!
"I did all of this and it still doesn't work!"
The really frustrating part is when you've done everything, only to see an error message on the live site. Unfortunately, there's no way to pinpoint what the problem is. Use some logic, though: if the error seems to be database related, make sure you go back into phpMyAdmin and ensure that all traces of the old URL are no longer referenced in the database (click the "search" tab and type in the old URL...anything that pops up as a result should be edited).
Most problems are database ones when it comes to a site move. Otherwise, it may be related to your .htaccess file referencing the old URL, or an improper setting in your Wordpress admin panel.
Comments?
Thanks for visiting!
Hope this tutorial has helped you to move over your Wordpress site!
-
-
perfectaperture
Oct 27, 2010 @ 4:50 pm | delete
- A really useful article. By far the easiest to follow to fix what I've been postponing for days.
Just wanted to add a couple of things.
When you describe exporting the old database, I couldn't find a way to export from phpmyadmin that didn't result in the line...
CREATE DATABASE `database name` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `database name`;
at the start of my file. Perhaps it's fine if your DB name and username are the same again but if you changed those details it wont import unless you delete that line in a text editor.
I might just have overlooked it, or it might be too obvious to bother describing but don't forget to upload the entire WP-Content folder from the original domain to the new one. Easy to overlook if it took you some time to cover everything else. I had to do something else for an hour before that particular lightbulb came on!
Really appreciate the article.
-
by Pixelrage
Hi, I'm Mark, and I go by the screenname "Pixelrage" - thanks so much for checking out my work here on Squidoo! If you need to get in touch with me,... more »
- 209 featured lenses
- Winner of 18 trophies!
- Top lens » The Best HDTVs for 2012
Explore related pages
- Best Wordpress Themes Best Wordpress Themes
- Wordpress Under Construction Themes Wordpress Under Construction Themes
- Wordpress Email Subscription Plugin Wordpress Email Subscription Plugin
- Best Wordpress Plugins Best Wordpress Plugins
- Wordpress Classified Themes Wordpress Classified Themes
- PotPieGirl's Internet Marketing Tools PotPieGirl's Internet Marketing Tools