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.

Currently, I have a blog that runs atop Tumblr, which is relatively young (3 months old or so, maybe 25 posts altogehter) that I want to migrate to a self-hosted Wordpress installation. I've installed and configured Wordpress many, many times, but I've never been able to figure this out. Here's what I'd like to do, ideally:

  • First, keep the existing blog up and active during the entire process
  • Install Wordpress somewhere public and migrate the content either by hand or using an import tool of some kind
  • Install whichever theme I end up using, customize the crap out of it
  • Switch the DNS for my domain so that users gradually begin to see the fully built and migrated Wordpress site instead of the Tumblr site.

Here are the problems with this as I understand them:

I won't be able to install the Wordpress blog within the domain in which it will ultimately live because that domain points somewhere else. For this reason, I'll need to install it on a different domain (test.realdomain.com or something) and do all of the import and theme dev stuff there. The bad part here is that Wordpress uses the post's full URL as it's GUID, so I'll have to hand-edit the database so that each post, page and media asset lives at realdomain.com instead of test.realdomain.com.

I'm wondering if, in all of my Wordpress travels, I've somehow missed a super easy solution to this problem. For a product as mature as Wordpress, I find it hard to believe that there's no easy way to, say, build a site in a staging environment and deploy it to production without have to manually edit database tables.

Any assistance offered would be greatly appreciated, and feel free to let me know if I've left out any details that would help clarify anything.

Thanks!

share|improve this question

6 Answers 6

up vote 5 down vote accepted

As others have already mentioned, this can be a long process. But it can also be relatively straightforward, and I've done this to migrate other non-WP sites to WordPress in the past.

Export your site

First things first, you'll need to export your site from Tumblr into a format WordPress can work with. There are a few tutorials out there on how to do this, but also one great tool built specifically for this purpose called Tumblr2WordPress.

You'll also want to make backup copies of any images you're using, just in case they're lost during the export/import process.

Set up WordPress on a temporary domain

Most hosting packages allow you to access your site from a temporary domain while in development. Use this feature to set up your WordPress site and tweak all of the settings to be just the way you want them.

Then ...

Import your Tumblr site

Once WordPress is up-and-running, import your old site and make sure everything is working the way you want it to.

Change the site URL

Now that WordPress is running, we want to tell it the correct domain name to use. So log in to your dashboard and go to Settings » General. Change both the site URL and blog URL to the values you want to use and click "Save."

This will temporarily break your site!!! You will not be able to log back in until following the next steps!!!

Edit your hosts file

On Windows, you can edit your hosts file to redirect domains to different locations. This will make it so, on your machine only, your site will appear at http://mysite.com even though it's actually at http://temporarysubdomain.myhost.com.

Flush your DNS

From the command prompt (i.e. DOS), run the command ipconfig /flushdns. This will flush your DNS resolver cache and speed things along a bit.

Log back in to WordPress

If you've done things correctly, you should now be able to access your site at http://mysite.com from the computer with the edited hosts file. Log in and make sure the site is still displaying as it should. Take a few minutes to edit any image URLs that broke in the transition and get things looking snazzy.

Point your domain

Now that WordPress is installed, configured to work with your domain, and displaying your migrated Tumblr content, it's time to actually point the domain at WordPress. Go back to your host and move the domain so it's pointing at the right location.

Reset your hosts file

Now that the domain is pointed, go back and un-do the changes you made to your hosts file ... otherwise there's no way to know when the transition has been made (your system will always be pointing to the right site, even if the rest of the world isn't).

Crack open a beer and watch a football game

Seriously. DNS updates can take a while to propagate over the Internet, so don't expect your re-pointed domain to work immediately. It might take 12 minutes. It might take 12 hours. This depends on your host and your ISP.

Go to your site domain

Check in from time-to-time during the football game you're watching to see if it's been pointed correctly (I recommend commercials and time outs ... they're boring anyway). Now that you're running with the default hosts file, you should see the new site immediately when the DNS finally pushes through.

Viola! You're done

If you've done all of the above steps correctly, you should be done. The entire process can take anywhere from 15 minutes to several hours depending on how long it takes for your ISP's DNS cache to refresh. I've used this process more than a dozen times on client sites and it works every time.

Some quick notes ...

  • When your images are imported, they'll likely be stored with the URL http://temporarysubdomain.myhost.com rather than http://mysite.com. You'll either need to create a server-side redirect to fix this, or manually edit your images. Since you only have 25 posts this isn't a huge deal to do by hand, but there are ways to automate the process with SQL search-and-replace statements if you're looking for a shortcut.
  • Do not touch the GUID! I can't stress this enough. The GUID stored in the database is a "Globally Unique Identifier" ... meaning it's unique for that specific page or asset, despite the domain you're on. Yes, WordPress uses the site's URL to generate the GUID, but that doesn't actually mean anything. It's just a static string that's not supposed to be used for anything except to identify the post as unique from others in the database. Even though your imported posts will have your test domain as part of the GUID, do not change this.

As always, if you have any questions, feel free to ask.

share|improve this answer
    
My only question about this: why even bother with the temporary domain? Why not do your hosts configuration before setting up WordPress and save the hassle of edits later? –  Harper Shelby Sep 22 '10 at 20:25
    
That's a potential route, but since I've never done it that particular way, I can't vouch for its success. I know the route I suggested will work ... though I'd be willing to experiment with editing the hosts file before the transition, just to see how things work. –  EAMann Sep 23 '10 at 5:16

Disclaimer - my experience only involves moving WP around.

First go over Changing The Site URL, it properly covers how WP stores and reacts to changes in URL as well as some tricks that make it easier.

The bad part here is that Wordpress uses the post's full URL as it's GUID, so I'll have to hand-edit the database so that each post, page and media asset lives at realdomain.com instead of test.realdomain.com.

Ignore that.

GUIDs are not meant and not used for front-end display. They act as extensive identifiers (in feeds for example), but real links that get displayed on site are formed completely separately.

I have local test stack - posts imported from blog have GUIDs with real domain, but run perfectly fine on localhost.

share|improve this answer

Our scenario is a little different, but has some similar characteristics. We're migrating a fairly large (500+ blogs, 14 or so domains) WordPress MU installation from a hosting provider to a new, client-hosted WordPress 3.0.1 installation. Here's our overall plan:

  1. Set up the new system at the client site.
  2. Use edited hosts files on the dev team's systems to point our dev systems to the new servers. Do all our dev and testing on these boxes.
  3. Perform the migration - in our case this is an overnight operation, and we'll be using the administrative message features in WP to communicate (after a brief downtime to snapshot the production database) that any changes made by authors/commenters/etc. after that point will be lost. Since it's a way off-hours thing, we don't anticipate lots of comments on the blog posts from front-end only users.
  4. Once we've migrated (and in our case, upgraded the database, etc.) and tested the new install, we'll publish the new DNS records.

If you want an after-action report, I can provide that sometime Friday (but not too early!).

share|improve this answer

There is actually no easy solution for this problem, and WordPress, out of the box, provides no way to move from development to production without manually editing the database. :)

You may want to look at this question: http://wordpress.stackexchange.com/questions/119/easily-move-a-wordpress-install-from-development-to-production where several ways to do it are discussed.

share|improve this answer

The super easy solution is to modify the hosts file on your workstation to point example.com to a different IP address. You can call up example.com in your browser and get the new server rather than the old, and see things just as you would if the change had propagated through DNS. This switch be simplified using a tool like ghost, but there are ways to do it on every platform via a hosts file.

The ghost way:

adam@compy:~$ ghost add example.com 10.0.0.1
share|improve this answer

About moving from a Tumblr blog to Wordpress using Ben Ward PHP script (Tumblr2Wordpress). Last time I tested it, it won't generate title for anything except regular post. This could be solve (given a little knowledge of PHP script) by using Tumblr {PostSummary} block, which was design within Tumblr precisely to create title where there are none (for RSS feeds, among other things).

Another important point to notice. Ben Ward great script (I really mean it: it's actually by far the best solution to move from Tumblr to Wordpress) won't import media (images for example). All images will be hot-linked to Tumblr's servers after the importation is done. Again, this issue is easily solved using one a plugin after the importation that will allow the Wordpress blog to automatically download hot-linked images.

share|improve this answer

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.