0

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?

2 Answers 2

1

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?

1
  • 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, 2012 at 19:58
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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