Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Relocate WordPress Install to different domain WordPress


I original set up a domain and hosting with a wordpress install. It was an alternate domain for testing while we finalized the site.

The real domain is - I would like when entering this domain it actually stays on this domain - right now I have a redirect going.

Please help

Answers (4)


Erez S answers:

Add this to your wp-config file:

define('WP_HOME', '');
define('WP_SITEURL', '');

Chad Mueller comments:

I obviously have to remove the redirect from the hosting company correct?

Erez S comments:

Well, if you have redirect on this domain to the second domain, then yes, remove the redirect and add the code I'v wrote for you.

Chad Mueller comments:

Yeah that seems to have worked - I have to clear some cache and do some further testing - but it seems to have done the trick....


Hardeep Singh answers:

Change the Site address(URL) in the settings page of wp-admin (admin panel).

Let me know, if you are unable to reach admin section, we can do it from DB too.

- Hardeep


Karl Oakes answers:

The manual solution:
1. On the test domain, export WP db from mySQL to a SQL dump file.

2. On the new domain, create a new DB for WP that matches your migration DB and then import mySQL dump to new DB.

3. Change 'siteurl' and 'home' columns in wp-options table to reflect new domain.

4. Download entire WP site from test domain and then change DB settings (DB_NAME, DB_PASSWORD, DB_USER) in the wp-config.php ( if required, not needed if you matched the db, user and password in your new domain ) to match new domain.

5. FTP to new domain.

Or use a plugin :


juaribd answers:

If you have posts on previous domain, you have to run sql query to replace address strings too. Here is the step by step things you can do.

1. transfer all files from to server.
2. get database dump of and import it in
3. run sql query to replace address strings. to do that, login into your phpmyadmin of Go to query and run these query :

UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, '','');

UPDATE wp_posts SET post_content = replace(post_content, '', '');

UPDATE wp_postmeta SET meta_value = replace(meta_value, '', '');

Finaly open wp-config.php in your and adjust the following parameters:

/** The name of the database for WordPress */

/** MySQL database username */

/** MySQL database password */

/** MySQL hostname */
define('DB_HOST', 'localhost');

Thats all.

juaribd comments:

One more thing, if you use phpmyadmin, easiest way to run query is select the Database name on left then on right side, there will be a tab called SQL . Paste the query in there and execute it.