最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

testing - How to disable redirect on teststaging copy of wordpress site

programmeradmin2浏览0评论

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) 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, it redirects (301) to www.example. 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.

>>> 

> --------------------------------------------
> 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:   /
...
Connection: close

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) 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, it redirects (301) to www.example. 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

> --------------------------------------------
> 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/
...
Connection: close
Share Improve this question edited Feb 25, 2021 at 21:07 RolfBly asked Feb 24, 2021 at 21:18 RolfBlyRolfBly 1215 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

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 with test.mydomain (https://interconnectit/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/plugins/updraftplus/)

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

发布评论

评论列表(0)

  1. 暂无评论