Case Study: Change Your URL Kill Your Site

I get the odd email from anxious people wanting to hire me because they have changed the domain name of their site and suddenly they cannot login in any more.

Here’s What They Do

They think that by changing the site URL and leaving the files where they are, they can change the URL structure of their site, this is wrong, you need to copy your files to the new location before you make the changes.  If you don’t WordPress redirects requests to fields that do not exist and your site will crash.

These are the options under settings->general

Here’s The Fix

To get your site back online you need to edit the wp-config.php files, this is in the root of your WordPress install, and add the following two lines with your original URL. These options overwrite anything in your database added by accident.

define(‘WP_SITEURL’, ‘http://{your original URL.com}’);
define(‘WP_HOME’, ‘http://{your original URL.com}’);

Connect to your site with ftp, or use the file manager in your hosting account, and edit the file wp-config.php

Now You Need to Edit the Database

If you want to revert back to your previous entries permanently you need to edit your database.  If you go to settings -> general now, you will see that your site and blog URL options are greyed out you cannot change these back.

Load up phpmyadmin or other tool provided by your hosting company, and open up the wp-options table and look for the siteurl and home options, edit these and roll back to the old URL.

WPTroubleshooting Will Feature This Fix

If you sign up for my WPTRoubleshooting members only course, I will be adding a screen cast video on fixing this issue very soon.

Image by rhysasplundh

Leave a Reply

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