Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

    http://localhost/wordpress/wp-content/uploads/2011/07/GSI-70-Automated-OAE-Screener.jpg

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!

share|improve this question
    
For the URLs, once imported to your new site use wordpress.org/extend/plugins/search-and-replace to fix the URLs, or start out right, develop using virtual hosts and your localhost URL can match your live devpress.com/blog/… –  Rev. Voodoo Sep 9 '11 at 13:36
    
Did you develop your site on a Windows system? –  onetrickpony Sep 9 '11 at 14:09
    
I am on osx. Damn should have thought of the virtual host idea! Yeah search and replace was my initial though. Thanks for a lot! –  rabbid Sep 10 '11 at 15:55
add comment

3 Answers 3

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. http://interconnectit.com/124/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/

share|improve this answer
    
Thanks! Will give the plugin a try –  rabbid Sep 10 '11 at 15:55
add comment

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:

    127.0.0.1 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/"
        </VirtualHost>
    

    (change paths accordingly)

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

        Include conf/extra/httpd-vhosts.conf
    
share|improve this answer
    
Fantastic ideas! Will try them. Thanks a lot –  rabbid Sep 10 '11 at 15:58
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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