|
原來地址:http://127.0.0.1/onsite/index.php/welcome/index/abc123
修改后地址:http://127.0.0.1/onsite/abc123.html
復(fù)制代碼 代碼如下:
<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>
規(guī)則是沒有錯的,但萬想不到CodeIgniter竟然報404找不到頁面;經(jīng)過測試在根目錄建立同名的html文件是能夠正常顯示的;
那問題應(yīng)該是CI的配置導(dǎo)致的;經(jīng)過一番波折,發(fā)現(xiàn)一個參數(shù):
復(fù)制代碼 代碼如下:
$config['uri_protocol'] = 'AUTO';
把它改成:
復(fù)制代碼 代碼如下:
$config['uri_protocol'] = 'PATH_INFO';
頁面終于顯示正常了;
php技術(shù):解決CodeIgniter偽靜態(tài)失效,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。