New version nginx leads to infinite redirection solutions for Wordpress,drupal frameworks

Source: Internet
Author: User
Keywords Wordpress nginx drupal Infinite redirect
Tags aliyun apache configuration drupal google google + google search google+

Server configuration is front-end with Nginx, back end with http://www.aliyun.com/zixun/aggregation/14417.html ">apache parsing php."

From the old version of the Nginx upgrade to the new version (>1.0), found that WordPress established sites are infinite cyclic redirection problem. Google search, found that many people encounter this problem, and not simply Wordpress,drupal, Phpcake and other frameworks have encountered the same problem.
WordPress's solution is to install a ban on redirection of plug-ins on it, but the flaw is, this will not be conducive to SEO. And this solution is not a common solution for the various frameworks, and if you don't understand the cause of the problem, what about the other sites that have the same problem? Unfortunately, after the search, the discussion of this issue did not reveal the ultimate cause. or decide to keep track of WordPress's source code, to see where the problem is. Why the old version of the Nginx no problem, the new version of the problem?

Tracking wp-includes/canonical.php code, you will find that when using the new version of the Nginx, visit the Site home page http://www.ithov.com/, the Apache received the request is http://www.ithov.com/index.php. And when the old version of the Nginx, the Apache received the request is http://www.ithov.com/. In other words, the new version of Nginx after receiving the http://www.ithov.com/request, sent to the background of Apache before, automatically appended to the back of the index.php, resulting from the original request URL is different, so many web framework redirection.

The solution is:
When configuring the Nginx server, be careful to configure location =/this individually.

server {
Listen 80;
server_name ithov.com, www.ithov.com;

//!!! Note here, focus on configuring the agent rules here
Location =/{
Proxy_pass http://127.0.0.1:81/; // !!! This here, the last side of a/can not be omitted
include/etc/nginx/proxy.conf;
}

Location ~ \.php$ {
Proxy_pass http://127.0.0.1:81; //!!! Here, at the back.
include/etc/nginx/proxy.conf;
}

.....

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.