Greg

Change WordPress Site URL

I’m almost positive many of you web developers have had to move a WordPress site in your day. Well, sometimes the domain changes, and you realize how much pain you’re in for since that involves scouring the database. Fear not! WordPress has a simpler alternative, a feature that is nearly as awesome as the picture above! Courtesy of the WordPress Codex:

Relocate method

WordPress supports an automatic relocation method that will figure out and update those values for you automatically. This method is intended to be a quick assist to getting a site working when relocating a site from one server to another.

To use it:

1. Edit the wp-config.php file.

2. After the “define” statements, add this new one:

define('RELOCATE',true);

3. Go to the wp-login.php page in a web browser.

4. Login as per normal.

When the RELOCATE flag is set to true, the Site URL (NOT the home setting) will be automatically updated to whatever path you are using to access the login screen. This will get the admin section up and running on the new URL, but it will not correct any other part of the setup. Those you will still need to alter manually.

You should remove the additional line after the site is up and running. Do NOT leave it enabled.

Simple, quick, and easy. Now fix the rest of the links that you forgot to make relative. Yep, you’re welcome for reminding you. 🙂