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 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 rules are correct, but I never expected that CodeIgniter reported 404 page not found; after testing, creating an html file with the same name in the root directory can be displayed normally;
The problem should be caused by the CI configuration; after some twists and turns, I found a parameter:
Copy code The code is as follows:
$config['uri_protocol'] = 'AUTO';
Change it to:
Copy code The code is as follows:
$config['uri_protocol'] = 'PATH_INFO';
The page finally displays normally;
http://www.bkjia.com/PHPjc/781027.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/781027.htmlTechArticleOriginal address: http://127.0.0.1/onsite/index.php/welcome/index/abc123 After modification Address: http://127.0.0.1/onsite/abc123.html Copy the code as follows: IfModule mod_rewrite.c Rewrit...