Codeigniter removes index. php from the URL

Source: Internet
Author: User

1. Make sure Apache supports mod_rewrite.

1) Open apache2.2 \ conf \ httpd. conf.
Search loadmodule rewrite_module modules/mod_rewrite.so (this is apache2)
Remove the previous #

2) Replace AllowOverride none with AllowOverride all (note: There are several)

2. Create a configuration file under the CI root directory named:. Htaccess. The file content is as follows::

Rewriteengine on
Rewritecond $1! ^ (Index \. php | images | robots \. txt)
Rewriterule ^ (. *) $/index. PHP/$1 [l] Note/index. PHP/$1 depends on your directory (web directory, such as http: // www. 34 ways. Com/index. php). For example, if the root directory of the website is/34 ways/index. php, it must be written /34 ways/index. php/$1 Note:Rewritecond $1! ^ (Index \. php | images | robots \. txt) Here is the path and file to be ignored. For example, you can write rewritecond $1! ^ (Index \. php | images | robots \. txt | theme)

3,Modify config. phpThe following content in this file

$ Config ['index _ page'] = "index. php ";

Change "index. php".

OK, so you can remove index. php.

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.