PHP Framework Codeigniter--url Removal index.php

Source: Internet
Author: User
Tags php framework codeigniter

Today learn codeigniter abbreviation CI first day, record learning experience.

CI China Https://codeigniter.org.cn/user_guide/general/urls.html?highlight=url Here is an introduction

Example.  COM/class/function/ID       
    1. The first paragraph represents the controller class to invoke;
    2. The second paragraph represents the function or method in the class to invoke;
    3. The third and subsequent segments represent the parameters passed to the controller, such as an ID or any other variable;
Removed fromindex.php in the URL

By default, your URL will contain the index.php file:

Example.  COM/class/function/ID       

1.

If your Apache server has mod_rewrite enabled, you can simply pass a . htaccess file (placed in the index.php sibling directory)

Plus some simple rules to remove the index.php. Here is an example of this file that uses a "negative condition" to exclude certain items that do not require redirection:

Rewriteengine Onrewritecond%{request_filename}!-frewritecond%{request_filename}!-dRewriteRule ^ (. *) $ index.php/$1 L

In the example above, other HTTP requests will go through your index.php file, in addition to the existing directories and files.

2.

httpd.conf Open LoadModule Rewrite_module modules/mod_rewrite.so If it is turned on, you can ignore it. 3. Restart Apache 4, application/config.php$config [' index_page '] = ' index.php '; --"index.php$config[' index_page ') = ';Http://192.168.1.89/welcome/index

PHP Framework Codeigniter--url Removal index.php

Related Article

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.