Having recently uploaded a Joomla site from localhost to a server without any problems, I was surprised that to do the same for WordPress was not quite as straightforward. It seems that many people struggle with this. The most common approach seems to be to use ‘search and replace’ in a text editor to change the site’s urls in its database before uploading. Once this is done, you export the site’s database from localhost and import it into the new server (you will need to create a new database on your server first). You also copy the sites content over to your server and change the wp-config.php file to match the new settings. A good description of this method is provided at Code my Own Road and also by Jason Bobich. Jason, however, provided an update last August pointing out that you might get ‘varied results’ using this approach and suggests an extra step (uploading a temporary php file) to overcome this.
This no doubt does work for some but judging from the cries for help on the net, not for all. I tried it but many links still pointed to my localhost, so I looked for another method, and found one at Ostraining.com, who always seem to give clear explanations. They recommend beginning by changing the site’s url in the WordPress admin settings. You still need to export and import the database, transfer the content and change the wp-config.php file, but there is no need to risk the use of search and replace in a text editor.
I still had to tidy up a few links but this method was quick and worked well. Whatever method you choose, make sure you back up and able to get your site working again on your localhost if things go awry.
The site by the way was for Lord Ian Strathcarron, an interesting fellow – travel writer, publisher, mediator and counsellor – www.ianstrathcarron.com, whilst the Joomla site I mentioned, is a lovely site for AliKats Mountain Holidays in France. Book your holidays now.