triptic

Weblog by triptic | Online Communication in Eindhoven

Moving wordpress using the ezmigrate plugin

Following up on my rather complex post about how the ezmigrate plugin came to life, this will be a simpler tutorial style post in which I will explain how to actually use the ezmigrate plugin to move or migrate your wordpress installation.

Keep in mind that some plugins might not work and need additional configuration changes after you have moved your blog. Please let me know about them.

I will distinguish between two types of migration: Only changing the url and moving to a new server.

Changing the url

You will only change the url to your wordpress installation. The code and database will stay on the same server. If you’re moving to a new server, please scroll down to “Moving to a new server”.

  1. Install the ezmigrate plugin (when it’s not already installed).
  2. Make the url change. For example by moving or renaming the wordpress directory or creating the new domain name and point it to your installation.
  3. If you are using a caching plugin: empty or delete the cache folder(s).
  4. If you are using Permalinks: go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file. (Text copied from the wordpress codex).

That’s it. There is no need to change any settings or do a search and replace in your database.

When you’ve moved to a new domain name and you don’t use any caching tool you will find that your wordpress installation still works on your old domain name as long as it still exists.

When you do use a caching tool and still expect visitors on your old domain you will need to make sure your old domain name will redirect to your new domain to prevent the cache from filling with pages containing old urls. This can be achieved for example by placing the following code at the top of the file wp-config.php:

if ($_SERVER['HTTP_HOST']!='www.newdomain.com') {
  header('HTTP/1.1 301 Moved Permanently');
  header('Location: http://www.newdomain.com'.$_SERVER['REQUEST_URI']);
  exit;
}

Moving to a new server

  1. Install the ezmigrate plugin (when it’s not already installed).
  2. Get a backup of your database by using any of the methods described at: http://codex.wordpress.org/Backing_Up_Your_Database
  3. Download all of the wordpress files to your local computer.
  4. Edit wp-config.php and change the database settings for the new server.
  5. Upload all of the wordpress files from your local computer to the new server.
  6. Place your database backup into the new database by using any of the method described at: http://codex.wordpress.org/Restoring_Your_Database_From_Backup
  7. If you are using a caching plugin: empty or delete the cache folder(s).
  8. If you are using Permalinks: go to the AdministrationSettingsPermalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file. (Text copied from the wordpress codex)

Again:  There is no need to change any settings or do a search and replace in your database.

Related articles:

Written by Onno Marsman
Tags: ,

11 Comments on “Moving wordpress using the ezmigrate plugin”

  1. Robert says:

    I use this wordpress plugin version 0.6, works great, except when I change permalink in edit post menu, i get errors when preview the edited post. It can not update the permalink structure once established. Sometimes this thing happens ,sometimes doesnt. I have tried to upgrade it to version 0.8, but the error just getting widen to url error in wp-admin…it had falsely looking for wp-admi folder, not wp-admin folder.

    I need to look at version 0.7 which is hard to find on download website.

  2. Onno Marsman says:

    @Robert: In the new version 0.9 a critical fix has been made. Please try this version and let me now whether you still experience any problems.

  3. Will Nesbitt says:

    I wonder what you would charge to deploy the plugin and activate several URLs?

  4. Hi,

    Hope this isnt too stupid of a question:

    If I want to essentially COPY a site from one domain to another (but change the content on the new domain), which approach do I use (new url or new server) if any?

    What I want to accomplish in the end is to take an existing site/blog that I like (with all its themes, plugins and widgets, posts, permalink settings etc that are already configured) and copy it to a new URL. Once there I will edit this ‘new site’ to be new and unique (i.e. new content, new links, new SEO tags etc)….I’m trying to simplify and speed up the process of creating new sites by copying old ones that I’m happy with and then simply edit the content to be appropriate for the new site topic…

    I find it a slow and tedious task to manually create a new WP blog on a new URL then essentially duplicate all the plugins, themes, settings (etc) in order to make it work as well as one I already have operational. I hope your plugin can help with this!

    Thanks in advance,
    Carrick

  5. Onno Marsman says:

    @Will Nesbitt: That would depend on the scope of the “project”. If you require services from triptic please contact us by phone or through the contactform on our website and explain in detail what you would like us to do for you.

  6. Onno Marsman says:

    @carrick: This type of thing is exactly what this plugin is useful for. To copy a wordpress database to a new installation (and keep the old one) you would need the “new server” approach.

  7. Eric Rudd says:

    Hi Onno,

    Thanks for this information and plugin. I have one clarification to request, since I know enough about this stuff to get myself in trouble.

    I currently have a blog located at http://www.mydomain.com/blog and would like to move it to http://www.newdomain.com at the root level. I am hosting with Godaddy and I’m able to have multiple hosting within my account. I’ve already registered the new domain and initiated the hosting request for it, I just haven’t set it up yet. Do I need to put a new installation of WordPress at the new domain name, then use one of the methods above?

    I don’t have a ton of posts in the blog yet (around 50), yet I want to do the cleanest and most Google-friendly migration possible. Is it better to have hosting associated with only one domain, or is it ok to use the same hosting with the new domain name?? Thank you for any advice.

  8. Onno marsman says:

    @Eric Rudd: sorry for the late reply, somehow your message hasn’t shown up on the website until now. If you follow the steps under “Moving to a new server” you should be fine. Putting the code there is one of the steps.

  9. Joshua McGee says:

    We started our wp site using a subdomain on our hosting server and then just now have gotten the domain from our GoDaddy account pointed at our hosting servers, so that we can begin using our real domain name. All the urls at this point are using the hosting server subdomain of course, so I think we just need to follow the change url process. I’m lost on the last step though:

    “If you are using Permalinks: go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file. ”

    We are using Permalinks .. but how do I update it to my .htaccess file?

    Thanks for your help,
    Joshua.

  10. Onno Marsman says:

    @Joshua McGee: I don’t think this step is necessary for you, because you’re just changing hostnames and your not really moving your blog into or from a subdirectory.
    If you do need to change the permalink structure just use the button “Save Changes” or if it says your .htaccess file isn’t writable copy/paste the code displayed into your .htaccess file.
    If your blog works fine without doing this, you don’t need it.

  11. Tamara Ingle says:

    Awesome, topic!! I just like it.

Respond to this post