How To Move A WordPress Blog or Website

For those of us who host our own blog or website, it is inevitable that it will have to be moved. First, you might need to move your blog if you are switching your web host. And second, you might also need to ‘move’ your website if you are transferring it to a new domain, new directory, or creating an alternate version on a local server.

Use the links below to navigate to the appropriate set of instructions.

Move WordPress to a New Hosting Package
Move WordPress to a New Directory
Move WordPress to a New Domain

Move WordPress to a New Hosting Package

Believe it or not, this is the easiest type of move. And there are two main ways to go about it.

Method 1: Use WordPress’ Built-In Import

WordPress features a built-in import to facilitate the process of moving content from one blog to another. And there are only three steps that you need to follow to get you blog up and running.

  1. Create an export file. On your own blog, navigate to ‘Export’ and create a WordPress export file. This is a special XML files which will contain your posts, pages,comments, custom fields, categories, and tags.
  2. Install WordPress on your new host. You will now need to create a working installation of WordPress on your new host. And be sure to upload your entire wp-content directory to the new installation.
  3. Import the WordPress export files. Now, navigate to ‘Import’ on the new installation and upload the export file that you created in step 1. And that’s it! Your website should be completely functional.

Method 2: Work Directly With The Database

Sometimes, due to hosting restrictions, or based on the size of your export file, Method 1 will not work so well. So now, you’ll hear about our preferred method. For this, you will need database access, (often phpMyAdmin,) and a little more technical knowledge.

  1. Create a database dump or database export file. Access your database and download its contents. Sometimes, a web host will have a utility which ‘backs up’ a database without ever having to access the database directly.
  2. Transfer all files. Using FTP download all files from your ‘old’ web host. And then upload them to your new web host. Be sure to update the settings in your wp-config.php file, which holds your database access information.
  3. Import your database. You will now need to access the new database. Once it is set up, import the file that you created in step 1.

Move WordPress to a New Domain or Directory

To move WordPress to a new domain requires a few more steps. As with the steps mentioned above, you will probably need to physically change the location of your WordPress installation. In addition, you will also need to update your WordPress settings and permalinks.

New Directory

The move to a new directory is likely easier than moving to a new domain. Here are the options that we suggest:

Option 1: Move Files

  1. Transfer all files. As in the steps above, transfer all files from the old directory to the new directory. Do not delete any files yet!
  2. Update your WordPress settings. In the WordPress admin area for the ‘old’ directory, go to Settings->General. Update the ‘WordPress address’ and ‘Blog address’ to reflect the change. When you hit save, the blog will no longer be accessible in your old directory.
  3. Update permalinks. Now, navigate to the new directory. You should see the blog up and running. Upload and activate the Update URLs plugin. Go to Settings->Update URLs and enter the appropriate settings to update all of your links. And presto, your website is ready to go.
  4. Clean up. Once you verify that the transfer was successful, you can delete the files in your old WordPress directory.

Option 2: WordPress Import/Export

You can also opt for the WordPress Import/Export file method given above as Method 1. If you choose this method, you will also have to update your permalinks using the Update URLs plugin.

Option 3: Only Change URL

Sometimes, it is not possible to change the physical WordPress directory. In these cases, you can change the url by simply updating WordPress settings. To do this, go to Settings -> General. Here you will find two settings: WordPress Address and Blog Address. By updating only the Blog Address, WordPress will ‘map’ to the new directory. Note: You will need to move the index.php file to the blog address directory.

New Domain

Likewise, there are multiple ways to move to a new domain.

Method 1 - revised (WordPress Import)

To move to a new domain, we suggest Method 1 above. If you have a lot of posts, this may be tricky as the export tool has been known to ‘timeout’. However, you might be able to create multiple export files by creating one file per author. The only modification to method 1 is the step below.

4. Update permalinks. Upload and activate the Update URLs plugin. Go to Settings->Update URLs and enter the appropriate settings to update all of your links.

Method 2 - revised (Database)

Similarly, you can also opt to work directly with the database, as in Method 1. If working with the database, you will have a bit more technical work on your hands. See step 4 below.

4. Update settings with SQL. One you have successfully imported the database, you will need to update some settings to make the website functional. SQL sample queries are listed below.

Sample Query To Update WordPress Settings

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-url.com', 'http://www.new-url.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Sample Query To Update Permalinks

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-url.com','http://www.new-url.com');

Sample Query to Update Any Links Embedded In Content

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-url.com', 'http://www.new-url.com');

Sometimes, you might have omitted the www from your domain when cross-linking posts or referencing images, so you should also run the above query without the ‘www’ for your old domain.

 

For more information on changing the website url, see http://codex.wordpress.org/Moving_WordPress and http://codex.wordpress.org/Changing_The_Site_URL.

Tags: , ,

40 Responses to “How To Move A WordPress Blog or Website”

  • On October 9th, 2008 at 10:11 pm, Susan wrote:

    Hrmm, I didn’t know you need the “update urls’ plugin to transfer a wordpress blog.

  • On October 13th, 2008 at 6:35 am, Velvet Blues wrote:

    Only if you want all links and image urls to be updated. It will work fine without, but will often necessitate a lot of extra work. :-(

  • On November 14th, 2008 at 6:31 pm, Kramer wrote:

    I tried your plugin to move my Wordpress blog to a new domain and now its just forwarding to the new domain with no content.

  • On November 14th, 2008 at 6:35 pm, Kramer wrote:

    Is there a way to undo the changes I did to the permalinks through ftp? I cannot get back into the wordpress admin…

  • On November 14th, 2008 at 6:43 pm, Velvet Blues wrote:

    Hi Kramer,

    This plugin doesn’t update any core settings. So this change that you are experiencing is because you’ve updated the WordPress urls under Settings->General.

    To move a website to a new domain, you cannot just update settings. You also, generally, have to move files. Can you move the files to the appropriate locations via Ftp (Do not delete anything.)

    (This plugin fixes one small problem, that of content and image links not updating after a move. But does not affect core settings.)

    So, here’s what I’d do if I was in your situation:
    1. Copy/Transfer all files to new destination.
    2. If it doesn’t work, go into the database to reverse the settings…

  • On November 14th, 2008 at 6:54 pm, Kramer wrote:

    Well first of all, I’m not trying to move any files. I’m leaving it on the same hosting and only changing the domain name. How do I reverse the settings in the database? Thanks in advance!

  • On November 14th, 2008 at 7:04 pm, Velvet Blues wrote:

    Scroll up and look directly under the subheading:
    “Sample Query To Update WordPress Settings”

    Except in your case, the new and old urls would be reverse. ie. Old Url would be the one that you set up in ‘Settings’.

    To get into the database, your host probably has some utility such as PHPMyAdmin. And then once you’ve edited the query with your urls, then run it on the database.

    Good luck.

    (As for the domain name issue, if the new domain name is pointed to your root folder, then your ‘move’ should have theoretically worked. So I’m guessing that the new domain is not completely active or perhaps it isn’t pointed to the same folder as the current website? Is it an addon domain in another folder?)

  • On November 14th, 2008 at 7:16 pm, Kramer wrote:

    Oh, this is probably whats wrong. I forgot to change the domain on the hosting. Hopefully that’s it. Thanks again!

  • On November 14th, 2008 at 7:59 pm, Velvet Blues wrote:

    No prob! I know how frustrating it can be to move a blog. :-)

  • On November 15th, 2008 at 11:44 am, Kramer wrote:

    Well your original solution (Method 1) for moving to a new domain seems to have worked flawlessly. The wordpress plugin made things a lot easier. I just forgot to change the hosting-domain link. Cheers!

  • On December 15th, 2008 at 10:11 am, Ghmkcatyo wrote:

    I would like to change the URL of my blog from example.com/a to example.com/b. In other words, I just want to change the URL of the blog while staying at the same domain. I have not yet made any location changes, and I am just exploring my options at this point. I have the ability to change the physical WordPress directory if I wish to do so. But “Option 3: Only Change URL” sounds so easy that it makes me wonder why anybody would want to use “Option 1: Move Files” or “Option 2: WordPress Import/Export”. But maybe I don’t comletely understand this whole matter. Is there any disadvantage at all in using Option 3? If there is no disadvantage, why would anybody want to use Option 1 or Option 2, which sound much more difficult than Option 3? By the way, I am using WordPress version 2.6.3.

  • On December 15th, 2008 at 5:50 pm, Velvet Blues wrote:

    Hi Ghmkcatyo. If you want to change the directory of your blog, you can simply update the settings and then rename its folder. (No moving of files required.) And then our plugin would update all urls in permalinks (for images) and in content links.

    For more information on Giving WordPress its Own Directory, take a look at this article in the WP Codex: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

  • On December 16th, 2008 at 2:29 pm, Ghmkcatyo wrote:

    Hi Velvet Blues,

    Thank you very much for your prompt reply.

    It would be perfectly OK if I lose all of my content when doing the migration. That’s because it is a new blog that has not yet gone live, and it only contains a few test posts that I will delete anyway before it goes live. However, I have spent a few hours customizing the blog’s templates, and I do not want to lose those customized templates. By the way, I have not added any images to the blog.

    Please answer the following questions from my original post:

    Is there any disadvantage at all in using Option 3? If there is no disadvantage, why would anybody want to use Option 1 or Option 2, which sound much more difficult than Option 3?

    By the way, I was kind of surprised to see you talk about a plugin in your reply. I had the impression (from reading your main article) that Option 3 does not require a plugin (which is one of the reasons that Option 3 sounds much easier than Option 1 or Option 2).

  • On December 20th, 2008 at 9:13 am, albert wrote:

    hi,
    I updated the ‘WordPress address’ and ‘Blog address’ to a unexisting url. So, now i can´t open the wp-admin… anybody knows how to update to the old settings????? really thanks… :(

  • On December 20th, 2008 at 10:32 am, Velvet Blues wrote:

    @albert, the only way that I’ve used to get out of this situation is to go into the database and update the settings. This can be done manually in phpmyadmin or by running an SQL query… Are you familiar with working with your database?

  • On December 20th, 2008 at 10:50 am, Velvet Blues wrote:

    @albert, Here is an easy solution: http://codex.wordpress.org/Changing_The_Site_URL

  • On December 20th, 2008 at 10:51 am, albert wrote:

    not at all… i think i can update it… but i don´t know the file that i have to update. i don´t a backup of this database… can i do anything?

  • On December 20th, 2008 at 10:53 am, albert wrote:

    thank you very much for your immediate response, I’m desperate!

  • On December 20th, 2008 at 10:53 am, Velvet Blues wrote:

    The file that they are referring to in the above documentation that I linked to is the ‘functions.php’ file. It is located in your theme directory… Do you have access to FTP? If so, navigate to:

    wp-content -> themes -> your theme name -> functions.php should be in this folder.

  • On December 20th, 2008 at 11:07 am, albert wrote:

    yes, i have acces to ftp and I updated this file, and all is the same…
    The problem is that when I do the login it redirect towards to the url that I putted in “WordPress Address and Blog Address”.

  • On December 20th, 2008 at 11:13 am, Velvet Blues wrote:

    Hmm. That’s strange. That should work… Well then, the only last option that I can suggest is that you update your database. Perhaps you have access to ‘PHPMyAdmin’ or some other database editing utility?

    You can manually search and edit values in the table, or you can run an SQL statement:

    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’;

    This site shows the process of working with PHPMyAdmin. (It’s probably an older version that you have, but the process is still the same.)

  • On December 20th, 2008 at 11:22 am, albert wrote:

    I am trying the second option of http: //codex.wordpress.org/Changing_The_Site_URL but it says:
    update_option(’siteurl’,'http://skibar.gpscerdanya.info/blog’); update_option(’home’,’skibar.gpscerdanya.info/blog’);
    Warning: Cannot modify header information - headers already sent by (output started at /nfs/c03/h02/mnt/52232/domains/skibar.gpscerdanya.info/html/wp-content/themes/design_showcase/functions.php:2) in /nfs/c03/h02/mnt/52232/domains/skibar.gpscerdanya.info/html/wp-includes/pluggable.php on line 850

    I keep trying with option 3….

  • On December 20th, 2008 at 11:26 am, albert wrote:

    i´m working with 2.7 in a new blog, i going to try to manually search and edit values in the table. maybe… it´s not the best place to writte it?

  • On December 20th, 2008 at 11:28 am, Velvet Blues wrote:

    It’s PHP Code…. Did you put it within the php tags?

    It looks like it outputted it directly, so you might not have…

    It should be after the <?php tag… on the next line.

  • On December 20th, 2008 at 11:49 am, albert wrote:

    :( was after….. sorry!!! but now is working!!!! :)really thanks!!! ;) i was desperate!!!!

  • On December 20th, 2008 at 11:50 am, albert wrote:

    blog is not working… but i will fixed it. Now i´m sure. A lot of Thanks!

  • On December 20th, 2008 at 11:53 am, Velvet Blues wrote:

    Great! And no problem. :-)

  • On December 21st, 2008 at 5:09 am, Ghmkcatyo wrote:

    Hi Velvet Blues,

    Please respond to post #13.

    Thank you very much.

  • On December 21st, 2008 at 8:34 am, Velvet Blues wrote:

    Hi Ghmkcatyo, If you don’t mind losing your test posts, then you don’t need to worry about a ‘real’ move. All you need to do is copy your current themes directory. And then after you create a new install in some other location, then upload the themes directory, overwriting the default directory. (And Option 1 & 2 accomplish the same end result. Option 3 means that your blog location is a different location than the files… However you will need to move the index.php file to the new directory.)

  • On January 10th, 2009 at 11:06 am, Clive wrote:

    As someone who has just started ‘flipping/selling’ blogs and wishing to offer to transfer a blog from my Reseller account to a buyer’s own hosting account as part of the sale this is great info.

    But, as I hope to be doing this a lot, can you recommend where I might go to find somebody to do this for me for cash - or do you know someone? i.e. Outsource, as while I love blog design etc. I am embarrassed to admit to being phobic about all of the above :oops:
    Clive’s last blog post..2009? Call Me Flipper!

  • On January 11th, 2009 at 7:40 am, Velvet Blues wrote:

    @Clive, thanks for stopping by. I don’t know anyone out there that does this, but we do offer this service starting at $50. ($50 for small/normal sized blogs, and up to $100, depending on number of images, and amount of data.)

    Otherwise, you can always try Craigslist.

  • On January 28th, 2009 at 3:15 am, Esben wrote:

    Thanks for a nice plugin, that i am sure i will be using a lot in the future! I have just tried it for the first time, but i am unsure of what excactly to put in the fields. I am moving a site from http://www.digitaludskrab.eu/actionplay to http://actionplay.dk

    Can you tell me excactly what i need to put in when filling out the two fields of the plugin in this specific case?

    Thanks in advance

  • On January 28th, 2009 at 8:40 am, Velvet Blues wrote:

    @Esben: Sure.

    In the ‘Old Url’, put the first url.
    In the ‘New Url’, put the second.

    Enter the urls exactly as you’ve entered them here.

  • On January 29th, 2009 at 9:17 am, Esben wrote:

    @VB:
    Perfect, thanks for a quick response!

  • On February 15th, 2009 at 12:30 pm, Hilary wrote:

    Hi there. Just to confirm, for Method 1: Use WordPress’ Built-In Import, this needs to be done once the propagating is complete, right?

    Thanks!

    Hilary

  • On April 7th, 2009 at 7:12 pm, Traci wrote:

    I’ve been trying and trying to move my word press blog to a new domain and host. All I keep getting is creat a configuration file, but should I do that since I’m not creating a new word press, just moving an old one?

  • On April 19th, 2009 at 10:31 pm, Mike wrote:

    My existing blog is running WP 2.1. I am trying to move it to a new domain. I installed WP 2.7 on the new domain and it is running fine unpopulated. I then followed method 2 above. New blog stopped working. Do I need to upgrade existing blog to 2.7 first and then move to new domain.

  • On April 30th, 2009 at 1:38 pm, Mags wrote:

    I’m hoping you can help me, or point me in the right direction to get help. I’m new to all this and very confused. Tried finding help on the net but not finding anything that has helped so far.

    Without going into a book on the details, this is a brief outline of my situation.

    2 domains. abc.com and xyz.com. I want wp to be xyz.com/blog

    abc.com is main domain and xyz.com is inside a folder of abc.com i.e. abc.com/xyz.com. xyz.com is classed as a pointer domain.

    There was a problem trying to install wp so the web host support staff got involved. Only one person was able to help, up to a certain point, and then I was left with what they did.

    What left with:

    In abc.com web directory
    folder for xyzwp
    folder for xyz
    plus all the web “stuff” for abc.com

    In xyz folder
    folder for xyzwp
    plus all the web “stuff” for xyz.com

    The xyzwp folder inside abc is the one the web host support person was able to generate a password for me, and is the wp which should be used.

    I should mention that trying to delete the xyzwp folder within xyz folder can’t be done by me. Don’t know if the support staff tried to delete it or not.

    When logged into wp under General the Wordpress address URL shows as abc/xyzwp and the Blog address is identical. I haven’t changed anything yet.

    Question: will this setup be able to show the blog address as xyz.com/blog or if not how do I fix it?

    Sorry for the long outline, but that is as brief an outline as I can give.

  • On May 11th, 2009 at 9:49 am, Rachel wrote:

    Your plugin rocks… I searched for info on how to move to a different directory.. your step by step was the best and your plugin made it even easier.. thanks!

    although wordpress notified me that the plug in was not tested with 2.7.1 - it worked great!

  • On May 15th, 2009 at 7:33 pm, Sam Small wrote:

    my wordpress folder got deleted by accident. My host, Godaddy, had me build a new mysql file and they restored the old database into that new file. I did the restore of the wordpress folder so my uploaded files are present, but when I reconfigured the wp-config.php to the new identity so they see each other the blog comes back essentially empty, none of my old posts, pages, comments etc. are present.

    I see that none of my widgets are in place, it’s as if the theme was reset to default. Also, all my plug ins are in the plug ins folder but none are activated nor applied.Wouldn’t my customized theme have come back with the restore of the Wordpress folder? Or is there some pointer to the mysql that WP is not seeing right? The new mysql has a different user name and database name than the old, but I updated wp-config.php to see the new mysql.

    Is there some other file that needs to be updated with those new names so the theme i customized comes back?

    Google has them cached for now, can I get the code from Google and plug the pages back in somehow? If so how?

    Thanks in advance.
    Sam

Trackbacks

Trackback URL for this entry:
http://www.velvetblues.com/web-development-blog/how-to-move-a-wordpress-blog-or-website/trackback/

Leave a Reply

Want us to work on your project?

Contact us today for a quote. Click here to submit details regarding your project.

If you are making a general inquiry, send an email to info@velvetblues.com