An example of solving codeigniter pseudo-static failure _php

Source: Internet
Author: User
Tags codeigniter

Original address: http://127.0.0.1/onsite/index.php/welcome/index/abc123

Modified Address: http://127.0.0.1/onsite/abc123.html

Copy Code code as follows:

<ifmodule mod_rewrite.c>
Rewriteengine on
Rewritebase/onsite

Rewritecond%{request_uri} ^system.*
Rewriterule ^ (. *) $/index.php?/$1 [L]

Rewritecond%{request_uri} ^application.*
Rewriterule ^ (. *) $/index.php?/$1 [L]

Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewriterule ^ (. *) \.html$ index.php/welcome/index/$1 [L]
</IfModule>

The rules are not wrong, but million CodeIgniter unexpectedly report 404 Can not find the page; After testing the HTML file with the same name created in the root directory is displayed correctly;

That problem should be caused by the disposition of CI; After some twists and turns, a parameter was found:

Copy Code code as follows:

$config [' uri_protocol '] = ' AUTO ';

Change it to:

Copy Code code as follows:

$config [' uri_protocol '] = ' path_info ';

The page finally appears normal;

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.