Sub-domain or 2nd, temporary different domain?

I would prefer Option 1, that is deploy it on a subdomain. Once contents are filled up you just need to do 2 things.

  1. Move the files to root directory of main domain. Using hosting’s File Manager, it would take 1-5 sec.
  2. Change the WordPress Site URL to your main domain. You can following method to change it without running a SQL Query (fetched from Moving WordPress)

wp-login.php can be used to (re-)set the URIs. Find this line:

require( dirname(FILE) . ‘/wp-load.php’ );

and insert the following lines below:

//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option(‘siteurl’, ‘http://domain.name‘ );

update_option(‘home’, ‘http://domain.name‘ );

If you have internal links (links in your post/page contents that links to your temporary subdomain URL), you can either update them manually or run a SQL query to update them all.

Update: To update the internal links you can run following SQL queries.

To update the links in page contents

UPDATE wp_posts SET post_content=(REPLACE (post_content, 'sub.domain.name','domain.name'))

To update the new domain name in post meta

UPDATE `wp_postmeta` SET `meta_value` = REPLACE( `meta_value` , 'sub.domain.name','domain.name'); 

Above Step 2, can also be accomplished with following query.

UPDATE wp_options SET option_value="http://domain.name" WHERE option_name IN ('siteurl', 'home')

if you have Database prefix other than “wp_” please change the table names with your prefix.

Leave a Comment