Move your WordPress website without accessing the MySQL server

Sometimes the simplicity of WordPress leaves me in amazement, I’ve been migrating WordPress websites for five years at least, but I’d always struggled on how to update the siteurl and home variables (these are what cause WordPress to redirect to the old address) without using an SQL client, until reading the Codex article on changing a website URL.

Changing your site URL in the WordPress database

Turns out, if you read the instructions it’s actually pretty easy. I’ve improved their function by creating some simple variables to compare the old details, simply place this in your functions.php file (or a site specific plugin for WordPress) and reload your homepage. It’ll execute once and then ignore itself in the future.

Updating links, and images in the Content

Once you’ve updated your website URL it should refresh to the new URL, but you’ll notice that links contained within your content are likely wrong. There are a couple of ways to solve this, my preference is to use the Search and Replace plugin for WordPress, which will allow you search across your website and replace the old site with the new site.

If you’re nervous (and you have every right to be), install and test some backup options before committing to a site wide search and replace.

Updating theme files

The last step when migrating a theme is to curse your first development team for hard coding your website address. Using a tool like Komodo, Dreamweaver or another IDE search across multiple files for your old site address and replace it with a PHP variable for your new website.

To do this, simple replace your old address ( ) with the function get_site_url() which will return your root URL. And remember, if you’re in over your head I’m available to help you migrate your WordPress website, or if you sign-up with Bluehost through my affiliate program, I’ll migrate your website for free.

Leave a Reply

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