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

How to prevent redirect 301

programmeradmin3浏览0评论

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

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论