源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

解决CodeIgniter伪静态失效

  • 时间:2022-10-25 03:11 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:解决CodeIgniter伪静态失效
原来地址:http://127.0.0.1/onsite/index.php/welcome/index/abc123 修改后地址:http://127.0.0.1/onsite/abc123.html
[u]复制代码[/u] 代码如下:
<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找不到页面;经过测试在根目录建立同名的html文件是能够正常显示的; 那问题应该是CI的配置导致的;经过一番波折,发现一个参数:
[u]复制代码[/u] 代码如下:
$config['uri_protocol'] = 'AUTO';
把它改成:
[u]复制代码[/u] 代码如下:
$config['uri_protocol'] = 'PATH_INFO';
页面终于显示正常了;
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部