Parsing CI--the rewriting rules of CodeIgniter framework under Nginx _php tutorial

Source: Internet
Author: User
Recently studied the CI framework, found that the framework of the routing function under Nginx problems, reported 404 errors, and later on-line search information,
Discover the need to turn on path_info. After nginx7.16 seems to support the path_info, just need to open in the configuration file.
Open the Nginx.conf file and add the rewrite rules under your virtual host code as follows:
Copy CodeThe code is as follows:
server {

Listen 80;
server_name www.ci.com;
Location/{
Root D:/WWW/CODEIGNITER_2.0.1/;
Index index.html index.htm index.php;
Rewrite ^/$/index.php last;
rewrite^/(?! Index\.php|robots\.txt|images|js|styles) (. *) $/index.php/$1last;
}
Location ~^ (. +\.php) (. *) $ {
Root D:/WWW/CODEIGNITER_2.0.1/;
Fastcgi_index index.php;
Fastcgi_split_path_info ^ (. +\.php) (. *) $;
Fastcgi_param script_filename $document _root$fastcgi_script_name;
Fastcgi_param path_info $fastcgi _path_info;
Fastcgi_param path_translated $document _root$fastcgi_path_info;
Fastcgi_pass 127.0.0.1:9002;
Include Fastcgi_params;
}
}

http://www.bkjia.com/PHPjc/327188.html www.bkjia.com true http://www.bkjia.com/PHPjc/327188.html techarticle recently studied the CI framework, found that the framework of the routing function under Nginx problems, reported 404 errors, and later on-line search data, found the need to open path_info. After nginx7.16 seems to support ...

  • 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.