Resolve CodeIgniter Pseudo Static Failure
- 2021-06-28 11:57:26
- OfStack
Original address: http://127.0.0.1/onsite/index.php/welcome/index/abc123
Modified address: http://127.0.0.1/onsite/abc123.html
<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>
There is nothing wrong with the rule, but it is unexpected that CodeIgniter should report that page 404 could not be found.It is tested that the html file with the same name in the root directory can be displayed normally.
That problem should be caused by the configuration of CI;After one wave, a parameter is found:
$config['uri_protocol'] = 'AUTO';
Change it to:
$config['uri_protocol'] = 'PATH_INFO';
The page finally appears normal;