Original address: http://127.0.0.1/onsite/index.php/welcome/index/abc123
Modified after address: http://127.0.0.1/onsite/abc123.html
Copy the Code code 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 not wrong, but million unexpectedly CodeIgniter reported 404 can't find the page, after testing in the root directory to establish the same name of the HTML file can be displayed normally;
The problem should be caused by the configuration of CI; After some twists and turns, a parameter is found:
Copy the Code code as follows:
$config [' uri_protocol '] = ' AUTO ';
Change it to:
Copy the Code code as follows:
$config [' uri_protocol '] = ' path_info ';
The page finally shows normal;