CodeIgniter Rewrite Rules in nginx

Source: Internet
Author: User
Tags codeigniter
Although apache configuration is simple and rough, for example, CodeIgniter can directly connect to apache without any configuration, but under a host with small memory, nginx is lightweight enough to cover up its disadvantages that are difficult to configure. If you are using CodeIgniter on nginx and find that all the pages except the homepage are 404, it must be a Rewrite rule error. Online Search

Although apache configuration is simple and rough, for example, CodeIgniter can directly connect to apache without any configuration, but under a host with small memory, nginx is lightweight enough to cover up its disadvantages that are difficult to configure. If you are using CodeIgniter on nginx and find that all the pages except the homepage are 404, it must be a Rewrite rule error. Online Search

Although apache configuration is simple and rough, for example, CodeIgniter can directly connect to apache without any configuration, but under a host with small memory, nginx is lightweight enough to cover up its disadvantages that are difficult to configure. If you are using CodeIgniter on nginx and find that all the pages except the homepage are 404, it must be a Rewrite rule error. Many of the rules found on the Internet seem useless.

Here is a Rewrite rule available for CodeIgniter in nginx (index. php is not removed ).

Location/{if (-f $ request_filename/index.html) {rewrite (. *) $1/index.html break;} if (-f $ request_filename/index. php) {rewrite (. *) $1/index. php;} if (! -F $ request_filename) {rewrite (. *)/index. php ;}}

Original article address: CodeIgniter Rewrite rules under nginx. Thank you for sharing them.

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.