时时商务社区
标题:
解决CodeIgniter伪静态失效
[打印本页]
作者:
新格网络
时间:
2018-2-14 05:57
原来地址:http://127.0.0.1/onsite/index.php/welcome/index/abc123
修改后地址:http://127.0.0.1/onsite/abc123.html
[U]复制代码[/U] 代码如下:
[I]
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]
[/I]
规则是没有错的,但万想不到CodeIgniter竟然报404找不到页面;经过测试在根目录建立同名的html文件是能够正常显示的;
那问题应该是CI的配置导致的;经过一番波折,发现一个参数:
[U]复制代码[/U] 代码如下:
$config['uri_protocol'] = 'AUTO';
把它改成:
[U]复制代码[/U] 代码如下:
$config['uri_protocol'] = 'PATH_INFO';
页面终于显示正常了;
您可能感兴趣的文章:
CodeIgniter框架提示Disallowed Key Characters的解决办法
codeigniter框架The URI you submitted has disallowed characters错误解决方法
让CodeIgniter数据库缓存自动过期的处理的方法
Codeigniter出现错误提示Error with CACHE directory的解决方案
欢迎光临 时时商务社区 (http://bbs.4435.cn/)
Powered by Discuz! X3.2