How to remove the hidden entry file index. php from the CI framework

Source: Internet
Author: User
When I re-access a framework, I must first remove the entry file, that is, index. php is not very beautiful in the url, and every time I access my website, it will be scored. when I re-access a framework, I must first remove the entry file, that is, index. php is not very beautiful on the url, and every time I access my website, I need to enter the url. This tells you how to remove the entry file in the CI framework, that is, to add a redirection operation. The operations on many frameworks are similar.

The words are turning ....

1.

LoadModule rewrite_module modules/mod_rewrite.so, remove the # before the row.

Search for AllowOverride None (there are multiple configuration files), view the comments, and change the row information of related. htaccess to AllowOverride All.

2. under the root directory of CI, that is, in index. php, system directory at the same level, create. htaccess, directly creating the file name will not succeed, you can first create a notepad file, save it as a file with this name. The content is as follows (this is also introduced in the CI manual ):

RewriteEngine on

RewriteCond $1! ^ (Index \. php | images | robots \. txt)

RewriteRule ^ (. *) $/index. php/$1 [L]

If the file is not in the root directory of www, for example, http: // localhost/CI/index. php/, the third line needs to be rewritten to RewriteRule ^ (. *) $/CI/index. php/$1 [L].

In addition, my index. php Directory has the js folder and css folder under the same level, which need to be filtered out, and the second line needs to be rewritten as: RewriteCond $1! ^ (Index \. php | images | js | css | robots \. txt ).

3. set the configuration file (system/application/config. $ config ['index _ page'] = "index. php "; set $ config ['index _ page'] = "";.

You can do this, but remember to start apache.

The preceding redirection rules can also be written as a. htacess file in linux. Put it in the root directory of the website.

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.