Optimization of PathInfo mode in thinkphp

Source: Internet
Author: User

Thinkphp 3.1.2 The Official Handbook, section 16.2, "Hidden index.php", mentions hiding index in Ngnix.PHP implements a SEO-friendly approach, which uses the following code location/ {   if(!-E$request _filename) {rewrite^ (. *) $/index.php?s=$1Last ;  Break; }} This method performance is very poor, because the image file will also be the existence of a file, the increase in disk IO overhead, in the "Nginx HTTP Server" in the book mentioned an optimization method, that is, modified to the following code. Location/ {   if($request _filename~* "\. (GIF|JPG|JPEG|PNG|SWF|JS|CSS) ") {       Break;//image files are no longer rewritten, and file presence is no longer judged, allowing Nginx to avoid useless checks and reduce disk IO overhead   }   if(!-E$request _filename) {rewrite^ (. *) $/index.php?s=$1Last ;  Break; }}#simple to no technical content, but the effect is good ~

Optimization of PathInfo mode in thinkphp

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.