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