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.com
> 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.com/
< 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.com 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.com
> 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.com 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 !

1

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

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

  • Thank you Rick for your answer ! In fact my problem was that in my wp-config.php I had configure access for production DB ...................... – Fred Sautot Mar 9 '17 at 13:56
0

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.com';

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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