CodeIgniterの擬静的失効を解決します。
962 ワード
元の住所:http://127.0.0.1/onsite/index.php/welcome/index/abc123
変更後の住所:http://127.0.0.1/onsite/abc123.html
その問題はCIの構成によるものであるべきです。波折を経て、一つのパラメータが見つかりました。
変更後の住所: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>
ルールは間違っていませんが、CodeIgniterは意外にも404ページを見つけられませんでした。ルートディレクトリに同名のファイルを作成するテストを経て、正常に表示することができます。その問題はCIの構成によるものであるべきです。波折を経て、一つのパラメータが見つかりました。
$config['uri_protocol'] = 'AUTO';
それを:
$config['uri_protocol'] = 'PATH_INFO';
やっとページが正常に表示されました。