Development WordPress admin link redirecting to live site

I’m trying to make new changes to a WordPress site I have. So I copied all files and exported to new development sub-domain. Made new database for the sub-domain and imported the database from live site.

Live site: http://mysite.com

Read More

Dev site: http://dev.mysite.com

Seems to be working, but all nav links still point to live site. And main issue is when I go to http://dev.mysite.com/wp-admin, I get redirected to live site. This is link I’m getting redirected to:

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

Any ideas?

Thanks

Related posts

Leave a Reply

4 comments

  1. The answers above are correct, most of the time editing the ‘home’ and ‘site’ url in the wp_options table will do the trick, however sometimes it’s necessary to run a search and replace on the database (use at your own risk):

    https://interconnectit.com/products/search-and-replace-for-wordpress-databases/

    This has worked very well for me in the past.

    Also, updating your permalink settings by going to Settings->Permalinks and just clicking ‘Save’ will often fix url problems.

    EDIT

    Alternatively, since you do not have access to wp-admin for updating permalinks, you can try this:

    Edit wp-config.php and add this:

    define('WP_HOME','http://example.com');
    define('WP_SITEURL','http://example.com');
    

    where http://example.com is your site url.

    Directly after “That’s all, stop editing!” insert this line:

    define('RELOCATE',true);

    Then, navigate to http://example.com/wp-login.php

    Please let me know if that works or not.

  2. in your wp_options table, edit the first few records (sorted asc by ID) and edit them to have the correct URL.

    You can also identify other options by using a SQL similar to SELECT * FROM wp_options WHERE option_value like ‘%mysite.com%’