How To Move WordPress To A New Domain

So late last night, I moved leland.info over to leland.me. I bought the leland.me name a while ago with the intention of “rebranding” leland.info with it, and haven’t gotten around to it until now.

This will be a quick post on how to properly migrate a WordPress site to a new URL, including the crucial task of redirecting old URLs to the new domain.

Step-By-Step WordPress Migration Process

I have a pretty simple process for moving WordPress sites. It’s not 100% ideal compared to a service like ManageWP or plugin like BackupBuddy, but it’s free and it works in most cases.

  1. Download /wp-content/ directory from current site
  2. Export database from current site (I usually just use PHPMyAdmin)
  3. Find and replace all mentions of old URL with new URL (caveat) in database dump
  4. Download a fresh copy of WordPress, upload the latest version to new site
  5. Upload /wp-content/ directory to new site, especially current theme and active plugins
  6. Create new database, import updated database file, connect database with WordPress
  7. Update permalink settings to regenerate .htaccess file on new site

Viola. I’ve successfully moved my WordPress site (formerly at leland.info) to a new URL (now at leland.me).

Hopefully you’re not doing bad things like altering WordPress core, otherwise that process above would have to be modified a bit.

Keep in mind this process may not be so efficient for larger sites, and could cause certain things to break (see caveat link above as an example). In my case, it worked fine.

If not, you’ll probably end up having to use a more polished solution like ManageWP or BackupBuddy.

Redirecting Old URLs to New URLs

But I still had the leland.info domain that had been established for several years as my personal blog, and wanted to make sure I did a 301 redirect for all the new URLs to leland.me.

Not doing so could cause link rot, broken bookmarks, and a near total loss of all of my SEO. I’d basically be writing myself a one-way ticket to 404 City, population me. I didn’t want to be the lone resident of 404 City.

Thankfully, this part was super easy. All I had to do is create a .htaccess file in leland.info’s public_html directory with the following:

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^leland.info$
RewriteRule ^(.*)$ https://le.land/$1 [R=301,L]

And that’s it. Obviously, you’d replace “leland.info” with your old URL, and “leland.me” with your new URL.

Special thanks to this WordPress.org support thread for the code, although this redirection technique can be used on pretty much any non-WordPress site (assuming the rest of the URL structure stays the same).

Keep in mind this .htaccess redirection technique may not work on every host or server environment, although if you’ve been using WordPress with pretty permalinks, it likely will.

Join the Conversation

1 Comment

Leave a comment

Your email address will not be published. Required fields are marked *