Original address: http: // 127.0.0.1/onsite/index. php/welcome/index/abc123
Modified address: http: // 127.0.0.1/onsite/abc123.html
Copy codeThe Code is 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 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:
Copy codeThe Code is as follows:
$ Config ['uri _ Protocol'] = 'auto ';
Change it:
Copy codeThe Code is as follows:
$ Config ['uri _ Protocol'] = 'path _ info ';
The page is displayed normally;