关于CI2.0伪静态化的疑问
设置.htaccess如下:RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1
#新闻模块
RewriteRule ^index.php/notice-detail-(+).html$ index.php/notice/detail/$1.html
http://ci.com/notice-detail-2.html(CI2.0提示404)
http://ci.com/notice-detail-2.html (CI1.7可以执行notice/detail/)
设置路由的话
$route['notice-detail-(:num)'] ="notice/detail/$1"; CI2.0可以生效URL
$route['notice-detail-(:num)'] ="notice/detail/$1"; 1.7URL404
求真相 这个用路由就可以做到,无需 rewrite。
路由你没有把 .html 放到规则里,这个你多调试调试,多尝试几种组合就可以了。 2.0下
RewriteRule ^index.php/notice-detail-(+)$ index.php/notice/detail/$1
http://ci.com/notice-detail-2 (CI2.0提示404)
http://ci.com/notice-detail-2 (CI1.7可以执行notice/detail/)
同样不能rewrite 不要用 rewrite 来实现路由能实现的功能。
建议仔细阅读 http://codeigniter.org.cn/user_guide/general/routing.html 请问那我怎么升级?原来的rewrite规则全部写成配置放在routes里面?
页:
[1]