Musings of ErisDS
beta
ErisDS

Note: Migrate! Was last updated 04/09/2011

 

If you work with multiple environments (development, staging, production etc) when building WordPress sites, you’ll know that WordPress uses hardcoded absolute URLs in the database for various tasks. There are lots of arguments as to why this is done, and whether it’s the best solution, but for now it remains quite difficult to migrate WordPress between environments.

Having worked in this way for a number of years, I’ve developed a script to help change the URL of a WordPress installation. This script, called Migrate! is now available to download.

Migrate! Essentially takes two URLs – the one you’re migrating from, and the one you’re migrating to, and replaces one with the other in all relevant parts of the database. The database queries used to do this have been actively tested in migrating sites to various production environments. The user interface and interactions are in development.

Necessary disclaimer: I take no responsibility for problems caused by the script, but you should have a backup beforehand anyway by the very nature of the script! Also.. anything you do with the script can be easily and completely reversed by switching the “from” and “to” URLS.

Why is this not a plugin?

Once WordPress’ files and database have been moved to a new URL, it is no longer possible to successfully login to and navigate around the WordPress backend without migrating the URL in the database. Therefore, the problem with having a migration script as a plugin is that the work to replace the URLs in the database would have to be done on the original install before the files and database are moved to the new server.

This means running the plugin, moving the install, and then running the plugin on the old install again if you still need it for futher development etc. In addition, many people, who don’t work with WordPress all the time, don’t realise there is a problem with migrating WordPress to a new URL until they try to do it.

So these are the main reasons for not having it as a plugin. However, there is a plugin version, which will hopefully also handle some other task involved in migrating a site, planned for the future.

Go get it

The Migrate! script has it’s own page on this site. From there you can download the plugin, find out how to contribute, log an issue in the comments and read about the latest developments.

Share this...

  •  Add 'WordPress: Migrate! Easy WordPress Site Migration' to Del.icio.us
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to Twitter
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to digg
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to FURL
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to reddit
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to Technorati
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to Newsvine
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to Stumble Upon
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to Google Bookmarks
  • Add 'WordPress: Migrate! Easy WordPress Site Migration' to FaceBook

Comments

6 Comments to "WordPress: Migrate! Easy WordPress Site Migration"
  1. 20th Mar

    Banago says:

    Great work – just forked it on Github. I have actually my own version of this that I was to release soon, but it is simpler right now as I only used it for myself and I knew what I was doing since I coded it myself. Great work again.

  2. 24th Mar

    ErisDS says:

    I’m glad you like it :)

  3. 11th Apr

    Chris says:

    Um. Isn’t this a bit Complicator’s Gloves?

    I’ve always found it fairly easy to move from one environment to another by performing a simple find & replace on the SQL dump inbetween…

  4. 11th Apr

    ErisDS says:

    Find and replace on a mySQL dump will break any serialised data in the options table. This will only happen if you have plugins which store URL data that way, but it’s a risk you take.
    Also, this is intended for use by people who have already made the mistake of overwriting their data and found they can’t login, as well as by devs who may or may not want to use it.

    Personally, I prefer to have a script I can run to do tasks like this, this file automatically gets added to every WP project I do :)

  5. 11th Apr

    Chris says:

    Aha. That’d be something to bear in mind, although I don’t think any plugin I’ve used does.

  6. 26th Sep

    Unwired Tech says:

    Perfect for my needs, usally I do the migration manually…and thank you for providing this as a free tool…

    Unwired

Add your thoughts

  • XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>