3/28/2017 - 1:35 PM

Change Site URL

Change Site URL

//Edit wp-config.php
//Add these two lines to your wp-config.php, where "" is the correct location of your site.

//This is not necessarily the best fix, it's just hardcoding the values into the site itself. You won't be able to edit them on the General settings page anymore when using this method.
//When RELOCATE has been defined as true in wp-config.php (see next chapter), the following code in wp-login.php will take action: 
if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
	if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
		$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], , $_SERVER['PHP_SELF'] );

	$url = dirname( set_url_scheme( 'http://' .  $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
	if ( $url != get_option( 'siteurl' ) )
		update_option( 'siteurl', $url );

1. Edit the wp-config.php file.
2. After the "define" statements (just before the comment line that says "That's all, stop editing!"), insert a new line, and type: define('RELOCATE',true);
3. Save your wp-config.php file.
4. Open a web browser and manually point it to wp-login.php on the new server. For example, if your new site is at, then type into your browser's address bar.
5. Login as per normal.
6. Look in your web browser's address bar to verify that you have, indeed, logged in to the correct server. If this is the case, then in the Admin back-end, navigate to Settings > General and verify that both the address settings are correct. Remember to Save Changes.
7. Once this has been fixed, edit wp-config.php and either completely remove the line that you added (delete the whole line), comment it out (with //) or change the true value to false if you think it's likely you will be relocating again. 
//Edit functions.php
update_option( 'siteurl', '' );
update_option( 'home', '' );

1.- open the wp_options table. 
2.- edit siteurl and home entryes