I have a productive wordpress site (example.com) and a test wordpress site (test.example.com).
For the two sites, I've a productive and a test DB.

Everytime when I'll access the settings for the test site (test.example.com/wp-admin), I'll be redirected to the productive site (the URL looks then like this: http://example.com/wp-login.php?redirect_to=http%3A%2F%2Ftest.example.com%2Fwp-‌​admin%2F&reauth=1).

I already changed the DB of the test site in the wp-config.php file, but nothing changed.

How can I change the test site to the test DB and making it independent from the productive one?

  • will they both be using same db? Commented Feb 28, 2014 at 8:18
  • @SudeepKRana: I think so, but how can I change the DB of the test when I can't access to the Settings of the test installation Commented Feb 28, 2014 at 9:10
  • @SudeepKRana: I changed the DB in the wp-config.php file to the test DB. But also now, when I'll access to the wp-admin area, it will redirect me to the main site. Here's the URL: http://example.com/wp-login.php?redirect_to=http%3A%2F%2Ftest.example.com%2Fwp-admin%2F&reauth=1 Commented Feb 28, 2014 at 9:14

1 Answer 1


Ok, you have two db's here, which is how it must be. One for your production site and one for your test site. You will probably copy between db's from time to time. I do that a lot between my production site and my test site which is on my computer locally. There are a couple of ways to change URL's, and this will be an issue if you copy between db's. I personally use a plugin called "Velvet Blues Update URL's". you can download it here

On your test site, as I believe that is where you have your problem, open the plugin. You will see two input field, "New URL" and "Old URL". Enter your production site's URL in the old field like this


In the new field, add the URL of your test field, like this


Now select all options under those two fields and click "Update URL's". After this, update your permalinks.

Hope this is what you were looking for. This will also work vise versa if you need to do this for production site

  • Sadly I'm unable to access the settings of the test site. I reformulated my question, please take a look at it. Commented Feb 28, 2014 at 10:23
  • OK, do this first. Go to your db for your test site and select that db. Select the wp_options table inside the db. option_id 1 is your site URL. change this to http://test.example.com. On the next page of the same table, go to option_id 36, which will be home. Change that URL also to http://test.example.com. You should now be able to log into your test site. You can now follow the answer above Commented Feb 28, 2014 at 10:38
  • Glad I could be of help. Commented Feb 28, 2014 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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