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
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
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: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.
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%’
Look in your WordPress database for the wp_options table.
In the option_name column, find the “siteurl” row. Change the option_value in that row to http://dev.mysite.com .
Look again in the option_name column for the row with “home” in it. Change the option_value in that row to http://dev.mysite.com .
That should do it.
Wp-login was missing from the dev site. For some reason, it didn’t copy over. So it caused the 404 when trying to access wp-admin.