WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created a subdomain (dev.mysite.com) and I duplicated my live site into this subdomain. However, when I go to dev.mysite.com, it loads mysite.com/dev instead.

I changed siteurl and home in wp_options to dev.mysite.com, removed the entire .htaccess, deleted W3 Total Cache, and it still does it.

When I just put a test index.html file, the subdomain loads correctly. It's only after I add the Wordpress files that it does this.

Am I missing something? What would cause this?

share|improve this question

Sounds like it is something left in your database. Try to make a new backup and import it again then run this SQL in your MySQL.

Input your old domain as http://www.old-domain.com and the new in http://www.new-domain.com, also if you have changed the prefix (wp_) to something other, change it before run.

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

This SQL changes all possible url:s from the old domain to the new one.

And you have not forgot to change the database in wp-config.php file?

share|improve this answer
Also keep in mind some theme files will retain your domain name, so those may need to be changed as well. In the base WP config, there's two places the domain needs to be changed... can be many more. I typically do a full find & replace through the entire DB, not just those tables. I also do a search through all the files. – user1337 Jun 11 '12 at 19:58

Or simply enable Wordpress network functionality. It'll then automatically handle all this for you, and even better you'll only have to do all your "network" updates once.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.