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
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.
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.
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.
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
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.
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: blogs, content management system, wordpressTrackback URL for this entry:
http://www.velvetblues.com/web-development-blog/how-to-move-a-wordpress-blog-or-website/trackback/
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
Hrmm, I didn’t know you need the “update urls’ plugin to transfer a wordpress blog.
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.
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.
Is there a way to undo the changes I did to the permalinks through ftp? I cannot get back into the wordpress admin…
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…
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!
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?)
Oh, this is probably whats wrong. I forgot to change the domain on the hosting. Hopefully that’s it. Thanks again!
No prob! I know how frustrating it can be to move a blog.
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!
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.
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
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).
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…
@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?
@albert, Here is an easy solution: http://codex.wordpress.org/Changing_The_Site_URL
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?
thank you very much for your immediate response, I’m desperate!
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.
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”.
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.)
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….
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?
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.
blog is not working… but i will fixed it. Now i´m sure. A lot of Thanks!
Great! And no problem.
Hi Velvet Blues,
Please respond to post #13.
Thank you very much.
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.)