This is not a tutorial, it’s the story of my first WordPress clone.
You can have several scenarios of moving a WordPress install around. 1) moving from one folder to another (same domain and hosting); 2) moving from local installation to online; 3) moving from one domain and hosting to new ones. What I had to do was the 3-rd case. As every other WordPress related problem, the solution can be found in a plugin. In my case, the plugin that was supposed to save the day was xCloner. It’s pretty good and capable plugin, which can be setted up to make cron backups of database and all files. There is clone functionality, that is supposed to copy a generated backup to a new hosting. To make it work, you need to provide a FTP access for the new hosting and than use a restore script on the new hosting. Yet, things weren’t that simple for me, and in this post I’ll share my experience and troughbleshooting.
You could save some traffic and wait-time, by having the plugin transfer the backup archive for you. The restore script, you are supposed to use later on, is transferred together with the archive. This restore script takes you through a guide of setting up the install and etc. Yet, if you take a look at the xCloner support forums, you will see that many people have unresolved issues exactly at that part of the process. Very often, the cause could be found in configuration of the host server, but who knows for sure?!
I couldn’t open any file in the address bar, at one point after the clone. It was givving me error 500 internal server error. You get this error when you have incorrect .htaccess file or wrong file permissions. The second one was fine – everything was set to 775, but I didn’t have a .htaccess file. Even creating one, didn’t help. The solution I came up with at the end, didn’t make any sense – I created a new folder where I moved all the files – than they were working.
Again – the automation from xCloner didn’t help me with importing the database. I had to make a manual import trough phpMyAdmin. There I faced the problem of missconfigured urls for all posts and images. The urls were those of the old web site. However, I could have used SQL query to replace them earlier in the options table:
UPDATE wp_#_options SET option_value = REPLACE ( option_value, '<old_domain>', '<new_domain>') WHERE option_value LIKE '<old_domain>';
Another way to do it, is by editing your sql export file in a text editor. Make a simple find and replace, and you’r done. My sql file was 36mb and it took a probably less than a minute for this process.
If you meet 403 forbidden you should know that it can be fixed with file permissions. I also had to manually change the information, of siteurl and home url from phpMyAdmin in wp_options.
Overall, xCloner helped me just to zip and transfer the web site – not to set it up afterwards. I suspect most of the trouble I came across, was due to the fact that one of the hostings was free and quite limited in options. Many people write great stuff about xCloner and I don’t want to disappoint you. Definitely, give it a try. I use it on all my WordPress sites as a backup tool.
Changing the website url – WordPress Codex
Moving WordPress – WordPress Codex
xCloner – official web site
Moving WordPress web site – Smashing Magazine article