Support » Fixing WordPress » nginx 301 redirect loop

  • Resolved Keith

    (@sononaco)


    I have recently switched one of our high-traffic sites from Apache to nginx.

    On a few of the posts I get this 301 redirect loop. For example, this page gives the loop:

    http://www.storyofstuff.org/2012/01/29/compost/

    But if you add a ? at the end the post loads fine:

    http://www.storyofstuff.org/2012/01/29/compost/?

    Other posts on the blog load fine, for example:

    http://www.storyofstuff.org/2012/01/29/concentrated-packaging/

    I followed the configuration to the letter here and have tried using the WP-nginx plugin. The only difference is I included the SSL directives.

    Looking at the headers send using curl I get the following:

    user@host ~ $ curl -i http://www.storyofstuff.org/2012/01/29/compost/
    HTTP/1.1 301 Moved Permanently
    Server: nginx
    Date: Mon, 05 Mar 2012 18:27:20 GMT
    Content-Type: text/html; charset="UTF-8"
    Transfer-Encoding: chunked
    Connection: keep-alive
    X-Powered-By: PHP/5.3.10
    Vary: Cookie
    Location: /2011/01/29/compost/
    
    user@host ~ $ curl -i http://www.storyofstuff.org/2011/01/29/compost/
    HTTP/1.1 301 Moved Permanently
    Server: nginx
    Date: Mon, 05 Mar 2012 18:27:33 GMT
    Content-Type: text/html; charset="UTF-8"
    Transfer-Encoding: chunked
    Connection: keep-alive
    X-Powered-By: PHP/5.3.10
    Vary: Cookie
    Location: /2012/01/29/compost/
    
    user@host ~ $

    Could it be an issue with the database?

    Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • If you could post your nginx configuration, that might help me/us to find if the issue is with nginx.

    Thread Starter Keith

    (@sononaco)

    Thanks for the response. We figured out that it was not the nginx configuration but they had installed the Redirection plugin that had mistakenly assigned the 2011/01/29 to redirect to the 2012/01/29 which was also redirecting to 2011/01/29. Just figured it out yesterday.

    Thank you for the follow-up!

    You are welcome. Glad to learn something about “Redirection” plugin. Thanks for sharing the root cause of this issue.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘nginx 301 redirect loop’ is closed to new replies.