I've been building a website using Wordpress for the couple of weeks on my localhost. My plan was to export it when I'm done and then import it onto the live server.

Today I found out a couple of things:

  1. Wordpress' Export tool only exports what's in the database, nothing else. It doesn't export images, etc. This could be easily remedied by simply copy pasting the files, but I was hoping for a complete solution where a tool will export EVERYTHING into a single zip file and then import than zip file onto live server to basically create an identical clone.

  2. The paths that is created within the XML file generated by the Export tool uses absolute paths, and this is especially troublesome. Example:


I haven't tested it, but I imagine that when I import this XML onto my live server Wordpress will look for a file at http://localhost/... and that's just not gonna work of course. It would work if the paths are relative paths.

What do you guys think? Any suggestions? Ideas? Solutions?

Thanks a lot!


4 Answers 4


I've seen a bunch of ways of doing this, but here are a couple:

  1. Use a plugin, like BackupBuddy (paid): http://pluginbuddy.com/purchase/backupbuddy/

  2. Export your whole DB using phpMyAdmin and run a search-and-replace tool that properly deals with the serialized data, e.g. https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ (I use this, and it works just fine). Then on the live server, create an empty DB and import this modified sql dump.

There was also a GSOC project this year for moving sites, called WordPress Move. Could work, not sure though: http://wordpress.org/extend/plugins/wordpress-move/


Another way to seamlessly switch from localhost to live (for MS Windows):

  • install WP on the live site.
  • from your site control panel download a database copy and a site back-up of your files, and copy them to your localhost (for eg C:/wamp/www/) and import the db in your phpmyadmin; it's better to do this the other way around to make sure your live site doesn't run into any compatibility issues with the database if you later import the db.

  • edit system32/drivers/etc/hosts file and point your site's domain to localhost: localhost yourlivesite.com

Now you can access your localhost WP version from your real site domain whenever that line in the Windows hosts file is present. WP will also think that this is the live site and you don't need to change paths, re-configure plugins etc.

The only thing you'll need to do is to import / export the database, which is pretty easy to do, and comment / uncomment that line from the hosts file, depending on which version of the site you want to access.

If you have multiple sites on your localhost in your "www" directory (like C:/wamp/www/mysite/, then you'll also need to create virtual hosts for each o them:

  • configure Apache from conf/extra/httpd-vhosts.conf:

  • change NameVirtualHost *:80 to NameVirtualHost *

  • add:

        <VirtualHost *>
           ServerName yourlivesite.com
           DocumentRoot "C:/wamp/www/yoursite/"

    (change paths accordingly)

  • in conf/httpd.conf you may need to add / or uncomment:

        Include conf/extra/httpd-vhosts.conf

WP-Cli, definitively, as explained here.

In you localhost:

wp db export

Upload the SQL file and the wp-content/uploads to your live server:

wp db import <sqlfile>
wp search-replace http://localhost http://live-location

I wrote a blog outlining a bunch of different ways to set up a testing environment for WP - it may be useful to you: http://wpmu.org/10-ways-to-set-up-a-testing-environment-for-wordpress/ Most of these take only a few minutes to set up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.