Solution to CodeIgniter pseudo-static invalidation-PHP Tutorial

Source: Internet
Author: User
Tags codeigniter
Solve the pseudo-static failure of CodeIgniter. Original address: modified address: 127.0.0.1onsiteabc123.html copy code: IfModulemod_rewrite.cRewrit original address: http: // 127.0.0.1/onsite/index. php/welcome/index/abc123

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

The code is as follows:



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]

The rule is correct, but CodeIgniter reported that 404 could not find the page. after testing, an html file with the same name in the root directory can be properly displayed;

The problem should be caused by the CI configuration. after some twists and turns, we found a parameter:

The code is as follows:


$ Config ['uri _ protocol'] = 'auto ';

Change it:

The code is as follows:


$ Config ['uri _ protocol'] = 'path _ info ';

The page is displayed normally;

The modified ingress address: http: // 127.0.0.1/onsite/abc123.html code is as follows: IfModule mod_rewrite.c Rewrit...

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.