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;