How to disable redirect on test/staging copy of wordpress site

This site I inherited runs a forum on a combination of Buddyboss and Buddypress. I've had to install ReCaptcha's on all user interactions, but I'm not happy with their layout and I'm suspecting buddyboss and buddypress conflict.

So, in order to find out how to fix things without breaking anything, I want a test/staging site. I tried the WP STAGING plugin, but it requires its own authentication, which bypasses the login pages I want to modify. That's not what I want.

So I created a subdomain (test.example.org) with our provider, and uploaded a copy of the production site in there. (Have not copied the database yet. Should I?)

The problem is that whenever I access test.example.org, it redirects (301) to www.example.org. I've been googling a few evenings to find answers, to no avail. Some site suggest I should reinstall WP in the test site, others have code hacks that did not work for me.

As you might have guessed, I'm new to the innards of WordPress, although I get by using it as a CMS.

So is there an easy way to remove the redirect? Is there more to setting up the test site?

Here's some of the reply by a redirection checker, perhaps that helps to clarify.

 https://test.example.org

 --------------------------------------------
 301 Moved Permanently
 --------------------------------------------

Status: 301 Moved Permanently
Code:   301
Date:   Wed, 24 Feb 2021 20:55:59 GMT
Server: Apache
...
X-Redirect-By:  WordPress
Location:   https://www.example.org/
...
Connection: close

Topic wp-redirect testing Wordpress

Category Web


WordPress stores the domain name of your site in the database (wp_options table among others). If you just copy the site and database the site will redirect to the domain mentioned in the database.

Option 1 : Using a php tool

You can do a search and replace using a proper tool to replace www.mydomain.com with test.mydomain.com (https://interconnectit.com/search-and-replace-for-wordpress-databases/ is one such tool).

Option 2 - Use a plugin

One of the backup plugins that will do this for you. You would install the backup plugin on the live site, create the backup file on your live site using the plugin. One the test site you would install a clean version of WordPress, install the same backup plugin, and then do a restore. (example plugin: https://en-gb.wordpress.org/plugins/updraftplus/)

Remember: Every WordPress install will need it's own database.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.