Cloned a site but can’t log in – redirecting to old site

I’ve cloned the production site at example.com to my own dev server, calling it example.mydomain.com. It displays OK, as long as I use port 8080 (bypassing my varnish server).

I can successfully log in to the wp-admin page at example.com, but I can’t reach the page at example.mydomain.com/wp-admin – it redirects to the homepage of example.com.

Suspecting my varnish set up might be at fault, I visited example.mydomain.com:8080/wp-admin and was presented with a login form.

However, entering the credentials there logs me into and redirects me to, example.com/wp-admin/ – the production site.
I’ve even looked at the query string that appears thus: http://example.myserver.com:8080/wp-login.php?redirect_to=http%3A%2F%2Fexample.myserver.com%3A8080%2Fwp-admin%2F&reauth=1 – which looks like it’ll do the right thing, but no joy.

I’ve done a full text search of the codebase, looking for places where the server name might be hard coded, and found nothing obvious (except some image links in the CSS).

So I’m thinking maybe there’s some config settings stored in the database. But I have no idea where to look.

1 Answer
1

Check for wp-config.php file.

Find these two lines to your wp-config.php, and make sure “example.com” is the correct location of your site.

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

Also on the database, check for table wp_options, check these two option_name; siteurl and home.

Leave a Comment