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
- www.domain.com to www.differentdomain.com or from
- www.domain.com/blog/ to www.domain.com
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 :
- Back up your files – Most blogs allow you to manually edit your theme/design via the blog admin area. So if you do edit files a lot online please make sure all the files on your pc match the files which are online. This means either downloading them from your server or copying them from your admin panel to the files on your pc.
- Backup your database – Most blog scripts allow you to back up your entries via the blog admin panel. However, i would strongly advise you to also back up via your hosting panel as well. If your using cpanel you will be able to do this through phpmyadmin. For phpmyadmin, you select your blogs database, go to the export tab, select all and then export in sql format. There are way too many blogging scripts and way too many different kinds of hosting panels for me to cover it here. If your unsure about how to do this though, please drop by the forums and start a thread about it and i’ll do my best to help.
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
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 :
- I changed my hosting account from bloggingtips.org to bloggingtips.com. My server automatically updated the domain name servers for the account
- I updated my blog to show bloggingtips.com as the url and not the org domain
- I set up a new hosting account for the domain bloggingtips.org
- I then uploaded an .htaccess file to the root of the domain to redirect all domains to their new url
- I then updated all references to the .org domain on the blog to .com
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
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 movedpermanently 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.