2
votes

For development purpose, I have duplicated the live instance files in a separate sub domain with different database. I modified the path the sub domain and .htaccess file including the database table setting changes. Everything works perfectly for the sub domain blog, However when I tried to access

http://dev.mysite.com/wp-admin

it is redirecting to

http://www.mysite.com/login?redirect_to=http%3A%2F%2Fdev.mysite.com%2Fwp-admin%2F&reauth=1

So the admin panel moving to root site admin.

I unable to find out which settings I missed out.

Any help/clue is much appreciated.

2

2 Answers

3
votes

WordPress hardcodes your hostname several places in the database, including 'siteurl' and 'home' in the wp_options table. This can cause trouble if you forget to update some of them when you are moving your site.

I run these queries whenever I move or copy a WordPress install:

# update wp_posts set guid = replace(guid, 'old.com', 'new.com');
update wp_options set option_value = replace(option_value, 'old.com', 'new.com');

In a production setting, the guid of posts should not change. In a development setting, when the new site is on your local machine, it sometimes makes sense to uncomment that first line.

0
votes

Take a look at the wp_options table in your database and make sure the siteurl value is set to http://dev.mysite.com/.

You can either use phpMyAdmin or if you have access to the database directly, you can view your option by:

select * from wp_options where option_name='siteurl';

And change it via:

update wp_options set option_value='http://dev.mysite.com/' where option_name='siteurl'