How to get rid of index.php in CI path

Source: Internet
Author: User

Apache Remove index.php

1. Edit the conf/httpd.conf configuration file

#LoadModule rewrite_module modules/mod_rewrite.so to remove the # before the line

Also configure allowoverride all under directory

2. Under the CI root directory (that is, under Index.php,system's sibling directory), create a new configuration file named:. htaccess content as follows:

Rewriteengine on

Rewritecond%{request_filename}!-f

Rewritecond%{request_filename}!-d

Rewritecond $!^ (index\.php|robots\.txt)

Rewriterule ^ (. *) $ index.php/$1

Rewritecond%{request_filename}!-f

Rewriterule ^ (application|modules|plugins|system|themes) index.php/$1 [L]

3. Put system/application/config/config.php $config[' index_page '] = "index.php"; Change to $config[' index_page '] = "";

4. Restart Apache

Nginx Remove index.php

1. Edit the nginx.conf file

Vi/usr/local/xxxxx/nginx/conf/nginx.conf

#nginx去掉index. php

Location/{

Rewrite ^/$/index.php last;

#防止某些文件夹被直接访问

Rewrite ^/(?! index\.php|robots\.txt|uploadedimages|resource|images|js|css|styles|static) (. *) $/index.php/$1 last;

}

2.config/config.php under Configuration $config[' index_page '] = ";

3. Restart Nginx

How to get rid of index.php in CI path

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.