Last week I moved this WordPress based blog to HostGator. Moving the blog to a new host service is usually a delayed decision for most people. This is mainly because of the fear of loosing data, potential downtime, lack of technical knowledge and even worries about the new service’ quality. Many times, people pay a lot more for renewing their current hosting services than switching to a cheap hosting that offer better service due the above worries.
Moving your WordPress blog is no rocket science and it is so damn easy if you follow the steps given below.
10 Simple steps to move a WordPress blog
Step #1 Prepare the new host space
Create a directory on your new hosting space where your blog has to be moved to. If your new host supports multiple domain hosting, you might want to add an addon domain using the cPanel. As much as possible, try to use the same directory name as your existing blog installation directory in order to simplify the moving process.
Step #2 Do a fresh WordPress installation
Now use your new host’s cPanel Fantastico tool (or the famous 5 minute install) to do a fresh WordPress installation.
You have to make sure that:
- The new WordPress release version is the same or higher than your current WP release
- Use the same admin panel login & password as your current installation, to simplify things
- Use the temporary WordPress installation URL to fill the WordPress address (URL) parameter in your WordPress Admin=>Settings=>General page. Also, change the Blog address (URL) accordingly (e.g. something like http://YourHostServerIPAddress/YourAccount/YourDomain.com/)
Visit your new blog installation using the ‘Blog address (URL)’ set above and make sure that the new WordPress installation (without your posts and theme) works fine. In order to avoid any accidental overwriting, you may want to keep a backup of your new wp-config.php in a safe place.
Step #3 Upgrade your current WordPress installation, if needed
From Step #2, if you installed a newer release of WordPress on your new host, make sure that your current WordPress installation is upgraded to that release via the standard upgrade process. It is better to complete the upgrade activities on your current playing field than on a new server and host. After the upgrade make sure that your upgraded WordPress blog and all your plugins work fine
(This step can be avoided if you decide to keep the target (new) WordPress release the same as your current one from Step #2. But this may not be possible when you use)
Step #4 Backup your current wp-content directory
Use your favorite FTP program (like the free FileZilla FTP tool) to backup the whole wp-content directory. In addition, you have to backup your robot.txt, wp-config.php and .htaccess files. Backup any other folders (e.g. download, temp, junk etc) and files that you might have created as well.
Step #5 Backup your current WordPress database
Use a tool such as phpMyAdmin (mostly available in your cPanel) to export your current WordPress database. Do not use the export feature in your WordPress admin panel as this would not take all your current settings but only the content (basically posts, pages, comments etc).
While using phpMyAdmin export, please make sure that you select:
- All your WordPress tables and SQL as the Export option
- Add DROP TABLE/VIEW/PROCEDURE/FUNCTION option
- Save as File
Now, when you hit ‘Go’ you will be prompted to save the database backup file on to your disk.
Step #6 Upload wp-content folder, .htaccess and wp-config.php
Use your FTP program to connect to your new host to overwrite the new wp-content folder with the backup that you created from step #4. Also, make sure that the .htacces files are uploaded to your new blog directory.
Step #7 Import your WordPress database
Open the phpMyAdmin tool from your new host cPanel, select the new WordPress database (usually named YourAccountName_wrdp1), and click the import option. Select the database backup file from Step #5 to import the entire data into your new WordPress table.
Step #8 Test your blog with the new host
Now it’s time to test your blog on the new host but before that you have to change the following settings.
- Just like you did in Step #2, change the General Settings blog URL to the temporary blog directory of your new host. With the database import, it may be now pointing to your actual domain name (e.g http://www.yourdomain.com)
- You do not need to upload your wp-config.php file, if you started with a fresh installation of WordPress as in Step #2. But if you opted to create a new database from the backup (using Step #5) and then setup WordPress, the old wp-config.php values may be handy
Now, test your new WordPress installation with the imported content and your blog theme using the temporary blog URL just like you did in Step #2.
Step #9 Import your mails, save your new comments etc
Before you make your domain permanently point to your new WordPress blog installation, make sure that you:
- POP (download) all mails from your previous host to your Outlook or your email client
- Copy any new comments (Commenter’s name, email, URL, comment text) that might have come during your installation so that it can be manually added to relevant posts later
Step #10 Switch the name server values
Logon to your domain registrar account (sometimes it is the same as your old hosting provider) and change the name server values there to make it point to the nameservers provided by your new host. After this, you have to log on once to your new WordPress control panel and change the blog address (URL) and WordPress address (URL) values to make them point to http://www.YourDomain.com/ and its WordPress directory (only if WordPress was installed in a different directory – for example, http://www.YourDomain.com/wordpress). Make sure that everything works fine
If you did not make any mistake and religiously followed the above ten steps, things should just work fine. Most of the issues are related to the wrong Blog address and WordPress address in the General settings section of your new WordPress admin panel. If you are not able to access the admin panel itself, you may want to use phpMyAdmin to open your new WordPress database, go to table wp_options, browse the rows and check the value of siteurl there. If it’s still pointing to your temporary installation directory or some other wrong value (check for typos), you have to correct that row manually.
If things still do not work, disable your plugins one by one and test. I had some problems with the Google XML Sitemap plugin which needs the chmod values of your sitemap.xml and sitemap.xml.gz files to be set to 666. You can do chmod settings for these files from your FTP tool.
The other common problem is the wrong wp-config.php usage. If you can’t connect to WordPress at all, please make sure to open and check the DB_NAME and DB_USER values in your wp-config.php file.
Further tips and precautions
- You can take the screenshots of your General settings, Permalink structure, Active plugins page and complicated settings pages of important plugins such as Google XML sitemaps, All-in-one-SEO plugin etc for future reference
- Keep important long text value (e.g. keywords) in some text file
- Before starting the upgrade itself, you may cut-paste backup the contents of all your widgets into some text file. I lost my widgets during the upgrade process
- Once the upgrade and move is complete, make a complete back up of your new WordPress installation directory on the server itself renamed to something like WP_2.8.2_Backup so that in case of any mistake done, you could rename and use this directory
- Never upgrade your plugins blindly even when the Plugin info claims that it is compatible with your WordPress release version. Make sure to backup the plugin folder before attempting to automatically upgrade it
- Check with your hosting service support team if you can’t solve the issues yourself. HostGator provided me wonderful chat support to fix some of the issues that I faced
- Choose an appropriate time to upgrade when your ISP is running in full throttle – I have minor issues with my ISP (Airtel) which suddenly slows down post midnight
I hope this ‘How to’ tutorial is useful to some of you and if so please do not forget to bookmark. Also, let me know if I missed out any point or steps. You can even ping me on twitter for free consulting if you encounter any problem with your WordPress move when you go for your next hosting provider.
Happy Blogging (with WordPress)!