How to prevent redirect 301

I'm encountering a 301 problem from my pre-production site which is automatically redirected to my production site.

I'm encountering a 301 problem from my pre-production site which is automatically redirected to my production site. I know the problem comes from WP because I already launched a curl in order to see responses either :

1) targeting the WP pre-production-site :

> GET / HTTP/1.1
> Host: www.pre-production-site
> User-Agent: curl/7.53.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 07 Mar 2017 11:51:19 GMT
< Server: Apache/2.2.22
< Location: /
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: sameorigin
< Vary: Accept-Encoding
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host www.pre-production-site left intact

2) targeting my own .php file uploaded on the pre-production-site :

> GET /up.php HTTP/1.1
> Host: www.pre-production-site
> User-Agent: curl/7.53.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 07 Mar 2017 11:54:29 GMT
< Server: Apache/2.2.22
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: sameorigin
< Vary: Accept-Encoding
< Content-Length: 2
< Content-Type: text/html; charset=UTF-8
<
42* Connection #0 to host www.pre-production-site left intact

I don't understand because I've already checked :

  • .htaccess file : doesn't contain any kind of redirection
  • Apache configuration files : seems OK too
  • source code (if a plugin would sets a Location: header) with a recursive grep : didn't find anything

Where is set this 301 ? I'm not sure if I left all informations that you need so feel free to ask me !

Thank you very much for your help !

I'm encountering a 301 problem from my pre-production site which is automatically redirected to my production site. I know the problem comes from WP because I already launched a curl in order to see responses either :

1) targeting the WP pre-production-site :

> GET / HTTP/1.1
> Host: www.pre-production-site
> User-Agent: curl/7.53.1
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Tue, 07 Mar 2017 11:51:19 GMT
< Server: Apache/2.2.22
< Location: http://www.production-site/
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: sameorigin
< Vary: Accept-Encoding
< Content-Length: 0
< Content-Type: text/html; charset=UTF-8
<
* Connection #0 to host www.pre-production-site left intact

2) targeting my own .php file uploaded on the pre-production-site :

> GET /up.php HTTP/1.1
> Host: www.pre-production-site
> User-Agent: curl/7.53.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Tue, 07 Mar 2017 11:54:29 GMT
< Server: Apache/2.2.22
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: sameorigin
< Vary: Accept-Encoding
< Content-Length: 2
< Content-Type: text/html; charset=UTF-8
<
42* Connection #0 to host www.pre-production-site left intact

I don't understand because I've already checked :

  • .htaccess file : doesn't contain any kind of redirection
  • Apache configuration files : seems OK too
  • source code (if a plugin would sets a Location: header) with a recursive grep : didn't find anything

Where is set this 301 ? I'm not sure if I left all informations that you need so feel free to ask me !

Thank you very much for your help !

Share Improve this question edited Mar 7, 2017 at 15:36 Fred Sautot asked Mar 7, 2017 at 13:01 Fred SautotFred Sautot 13 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 1

Did you check the 'options' table in your WP databasse for the two instances of the domain name (something like 'http://www.example ' ).

Not clear if your pre-production site is hosted on a local machine, or networked server. Might be some firewall redirection rules causing issues.

Just a little clarification of @RickHellewell's answer:

To prevent Wordpress from redirecting to my live site when I copied the database to my local machine for development work, I updated two rows in the database with the following query:

UPDATE wp_options SET option_value='http://localhost' WHERE option_value='http://mylivesite';

This allowed me to load (and work on) my site locally by visiting http://localhost and http://localhost/wp-admin

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745607313a4635744.html

相关推荐

  • How to prevent redirect 301

    I'm encountering a 301 problem from my pre-production site which is automatically redirected to my production site.

    2小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信