Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.