If you have visited my blog before you will know that this site used to be on bloggingtips.org. I was lucky enough to secure the .com domain. You can read more about it in my post ‘I’ve Secured my identity‘.
I’ve decided to write a guide to help those who are considering moving their blog to a different position on the web. Be it from
or from
Moving your blog to a different area on the web
It doesn’t matter your moving your blog to a different folder on your domain or if your moving your blog to a totally different domain name due to branding or whatever, the process of moving your blog is the same.
The whole process can be dauting to a blogger who has more experience in writing that running a website. It needn’t be though.
The first thing you need to do is back everything up. Sure you can risk it but it’s something you really shouldnt ever do. Whenever you are changing something major on your site or moving files about you should always, always back up.
Ok, so heres what to do first :
You should now have everything backed up so in the event of anything going wrong you can reupload your database and everything should be fine. However, your blog should not be affected as you aren’t going to touch your live site at all.
Whether you are moving your blog to a different domain or if your just moving it to a different area of your domain, you will need to set up a 301 redirect but i will address this later in the post.
Moving your blog to a different directory
I have noticed a lot of bloggers who install their blog in a sub directory called blog or blogs or something similar. Sometime later, they wish they had installed it in the root directory of their domain. One of my commentators has did this. Leeroy from Green Llama installed his blog at www.greenllama.net/blog/ instead of www.greenllama.net. I’ll use his site as an example
The root of the domain redirects to the sub directory /blog/ which is where wordpress is installed. For me, its always best to install the blog in the root of the domain for branding and search engine purposes etc. If someone moves their blog to www.greenllama.net he may experience a short change in page rank and search engine traffic but i dont believe this will affect Leeroy too much as both his blog page and his home domain have a page rank 4.
So what does Leeroy need to do?
First thing he needs to do is upload all of his wordpress files to his home directory using an FTP program (It is possible to copy all the files via unix commands using a console but ill assume that most bloggers arent too familar with unix). Note, i strongly recommend Leeroy not to touch the /blog/ directory until everything is moved.
So his wp-content directory will have been copied from www.greenllama.net/blog/wp-content/ to www.greenllama.net/wp-content/ and so on and so on (make sure file permissions are the same).
The great thing about moving a blog to somewhere else on the same domain name is that you don’t need to touch the database (backing up is still advised incase somethings up). If he uploaded all the files correctly then www.greenllama.net should show his blog as its accessing the same database as the config file in the blog sub directrory. All he needs to do now is go into the admin panel via www.greenllama.net/blog/ and change the url of the site to www.greenllama.net. Hey presto! The site should now be working fine on the main domain. Note, he would also have to move the redirect from the home directory so that visitors aren’t redirected to the blog domain anymore.
The only thing left to do is amend the .htaccess file so that files are redirected.
Moving your blog to a different domain
This section is also applicable to moving your blog to a new server
Note : I will assume in this section that the reader owns the domain name the blog is moving to and the one it used to be on.
As you know, i moved bloggingtips at the start of this week from bloggingtips.org to bloggingtips.com. Since i own my own server the whole move took me about 5 mins to complete.
Heres what i did :
The last action took me about 10 mins but the actual process of moving the site was quick, easy and painless. Clearly, to move a blog to a new domain you would have to own your own server and for the majority of you reading this you will not have this and will instead be on a Virtual Hosting Account (Usually known as a VPS = Virtual Private Server).
So for most of you out there you will need to do it the old fashioned way ie. you need to upload all files to the new domain and then sort out the database so that all your posts etc is transferred. Again, make sure that file permissions are set correctly and make sure the config file has the correct details for your new url and database.
Now different blog scripts work in different ways when it comes to restoring a database. With some blogs you just need to upload the files and the new database and your good to go. Not all blog scripts work in this way. With some blog scripts you need to do a fresh install and then import the entries. If this is the case, you should backup the files using the export method of your blog script and then import the entries to the fresh installation. Check the documentation for the blog script you use for more details (again, please start a thread in our forums if your struggling with it)
Setting up the redirect
Note : if you are just moving to a new server you do not need to setup a redirect
The 301 redirect is the search engine friendly way to tell search engines that a page or pages has moved permanently to new place on the internet. All you need to do is place a .htaccess file on your server to forward pages. Make sure you place the file in the directory where pages need to be redirected. For example, i had to place the file in the root directory but Leeroy would have to place the file in the /blog/ directory.
Please note that your host needs to be on apache for this to work. You can also do redirects using php, asp etc however htaccess is the search engine friendly way of doing it.
Here is the code i placed in the .htaccess file to redirect bloggingtips.org to bloggingtips.com :
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.bloggingtips.com/$1 [R=301,L]
The above code redirects all files in the directory to redirect to bloggingtips.com
So http://www.bloggingtips.org/2007/04/10/the-good-the-bad-the-ugly/ redirects to http://www.bloggingtips.com/2007/04/10/the-good-the-bad-the-ugly/.
It should also be noted that if you have edited your htaccess file on your blog to be more search engine friendly you would also have to edit that so that urls are parsed correctly.
Summary
I hope this guide has helped the process of moving host or moving your blog less daunting. However, i stress that different blog scripts work in different ways so please consult the documentation on the home site of the script you use.
If you need any tips or help with this kind of thing please leave a comment or start a thread in our forums and ill do my best to help.
Good luck
Kevin
Author comments are in a darker gray color for you to easily identify the posts author in the comments
Comments are closed since this post is older than 30 days. However, you can continue this discussion in our popular Blogging Forums
Thanks for the writeup Kevin.
One day I’ll have to stop being lazy and make this change… I think I’ll do it in the coming weeks. Though while I’m at it, there is one more change I’d like to make. Currently my permalinks are like yours – they should the year/month/day. I want to take that out , and have them look like
http://www.greenllama.net/giant-dogs-eating-fish/ or whatever. Just a cleaner setup. Any chance you can amend the tutorial to show how to do the redirect for that?
Sorry maybe you can make that link not-live, it’s not a real page ;(
changing the permalink structure requires a totally new guide. i dont think its something that should be lumped together in this guide
first of all, its very easy to change your permalink structure. you just need to do a small edit of the .htaccess file
however, changing the structure so that internal links and search engine rankings arent lost requires a more complicated edit on .htaccess such as this or this.
Heya Kevin,
I finally mustered up the courage to give this a go. Do you happen to know the unix command to copy everything from /blog/ to / ? I’m on a slow connection here at work, and can’t download everything / re-upload to a different directory, as it would take about 9 days.
I can login using Putty ( that’s how I get to the crontab ) – if that helps.
sorry leroy – i leave in an hour to go travelling. i dont know it off the top of my head (been a while since i did it at uni!)
if your having problems drop me an email though being realistic i wont be able to look into this and help you for another 3-4 weeks
No worries, I can probably stumble through it.. just trying to be lazy
I didn’t know you were travelling – enjoy your trip, wherever you’re going. Talk to ya when you get back.
Hi..
I must say that it is a step by step guide to transfer ur blog. It is worth reading. I came to this site from Curt’s blog and found this post too useful. As I am going to need these info in near future when I a=will be signing up for a new hosting service.
Thanks again.
I usually install wp in subdir
for me it’s easier to organize files
If I want to call wp from root url
I use this method
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
http://codex.wordpress.org/Moving_WordPress
Hi, I wonder if you think there is any advantage/disadvantage to having a blog in a sub-domain rather than the root. Particularly regarding SEO and page rank?
I ask as I want to move my blog to a new server and get a dedicated domain name or maybe put it in a directory like http://www.beara.ie/blog/ rather than (as is now http://www.blog.beara.ie and thought appriciated.
ALl the best from Ireland
Dave
Thank you. You just saved me a whole load of research. I’m just moving from a shared host to a VPS, and at the same time wanted to get rid of the /blog/ in the URI (yes, I’m another Leroy).
I’ve tried that three-line .htaccess file in the /blog/ directory on a test site and it works like a charm. Let’s hope it works when I do it for real.
Now if you could just solve the problem I where all the curly apostrophes and Asian script get garbled on export from the database, I would be very happy. But no matter how much I play with the collation I can’t get it right
I’m kind of resigned to doing a whole load of manual corrections.
Hi Philip, Glad you found the article useful. With regards to your character problem, I covered this last July.
Check out this article :
Fixing the  and †problem in wordpress
Kev:)
Hi Kevin
I’ll approach this with minimum expectations, because then I won’t be disappointed (and because I think the real problem is that I screwed up the collation of my database big time, including the fact that I changed the collation from latin1 to utf8 sometime over the lifetime of the blog).
But I’ll give it a go, and if it works, you’re an official superhero.
Philip
Unfortunatly, no joy.
Here’s an example page from the live site
Here’s what it looks like once I’ve done a dummy run of the move.
The steps were
1: export the whole database from the live site using phpmyadmin (it’s at this stage that the characters get garbled)
2: open the resulting sql file in a text editor to change all instances of http://www.londonkoreanlinks.net/blog to test.londonkoreanlinks.net (I haven’t bothered copying over all the images, hence most of the images won’t show in the test site).
3: drop all the tables from the database of a brand new fantastico WP2.3.3 instal.
4: make sure the new database is set to utf8 collation
5: import the sql file
6: run the plugin, and hope for the best.
[I also tried an additional step between 2 and 3 before I tried the plugin: open the sql file in a text editor and do a bulk search and replace of all the screwy characters I knew about and replacing them with the apostrophes I wanted. Unfortunately that made the import at stage 5 fall over with too many syntax errors]
Like I said, I’m reconciled to some heavy labour here, but thanks very much for the suggestion.
Cool site
Thanks.
if you export the database and just do a find and replace using textpad (from textpad.com) and then reinstall it, it should get rid of all of the garbled characters
try that – export the database and open it in the textpad editor and then find each messed up sequence and repair all references to it in the file and once you’ve fixed them all reupload it
Thanks Kevin
I did try that, but it created huge numbers of errors in the SQL syntax when I tried re-importing it. I could see it was going to take me just as long to manually fix the SQL syntax as it is going to take me to go through and correct the screwy characters manually.
So I’ve decided that I’m just going to go ahead and polish the final results over the next few weeks.
Philip
I found that there are only 4 or 5 different kind of problems that are messed up. Most of the issues are with the ‘ character so if you try find and replace you should be able to fix it quite quickly.
I decided to give it one last go. You’re right about the main culprit – the single apostrophe which came out as ’.
What I had been doing was search for [ ’ ] in the sql text file and replace with [ ' ]. Seemed logical enough. But that single apostrophe really screwed up the MySQL when I tried reimporting. Examining the export file more closely I noticed that actually where the browser delivers a single apostrophe the SQL query has two.
I therefore found that if I replace [ ’ ] with [ '' ] (that’s two single apostrophes with no space in between) it all seemed to work when I reimported the table back into the database.
Similarly replacing [ “ ] and [ †] with [ " ], and [ – ] with [ -- ] ironed out most of the other problems.
So now I’m just faced with the much smaller task of cleaning up the Asian characters, which has got to be a manual task.
Cheers
Philip
Glad your on the right track.
Good luck with the rest of it
OK, maybe one last request for help. The .htaccess redirect works like a dream. Mostly.
So http://www.londonkoreanlinks.net/blog/anything-you-like is redirected to http://www.londonkoreanlinks.net/anything-you-like. And http://www.londonkoreanlinks.net/blog/ (with slash) redirects as well.
But http://www.londonkoreanlinks.net/blog (without slash) doesn’t work. I’ve tried adding “Redirect /blog http://www.londonkoreanlinks.net/” to the .htaccess file in the root directory (I’ve tried putting it (a) before and (b) after the WordPress permalink coding) and it still doesn’t work. Any thoughts?
Cheers
the link with /blog is redirecting to ‘/home/londonko/public_html/blog’ which is the unix address of your blog. I would speak with your host to see if there is a way to fix this.
Dont know if there is a way round this but dont think people would check blog without the / anyways
Well, it was the shortcut stored in my browser!
And guess who the clueless webhost is? Me.
(Well, VPS manager, anyway). Not to worry. I’ll live with it
Philip
Excellent post and just what i was looking for. How did the move go SEO wise? Did you lose any pr or se rankings?
I’m going to have to change the domain name completely rather than go from org to com etc. and I am worried about losing traffic.
As long as you use a 301 redirect your rankings should still be ok