【发布时间】:2013-03-12 14:50:12
【问题描述】:
我正在尝试使用带有 codeigniter 的重写器来缩短我网页的 url。
我的 .htaccess 中有:
RewriteEngine on
RewriteBase /ci/
RewriteRule ^([0-9a-zA-Z_-]+)?$ index.php/controller/method/$1
但似乎我的应用程序忽略了所有内容。
我说:
http://localhost/ci/variable
并显示错误页面:
找不到对象,错误 404。
LoadModule rewrite_module modules/mod_rewrite.so 也没有评论。
我已经在一个简单的项目中完成了它,并且看起来它可以工作,但不是我的 codeigniter。
有人可以帮我解决这个问题吗?
谢谢。
已解决:
Adding RewriteEngine on
RewriteRule ^([0-9a-zA-Z_-]+)?$ /ci/index.php/controller/method/$1 [L,R=301]
【问题讨论】:
-
那是你的真实代码吗? /controller/method/ 不应该那样。它的 /*nameOfYourController*/*nameOfYourMethod*/
-
RewriteBase 上的 RewriteEngine /ci/ RewriteRule ^([0-9a-zA-Z_-]+)?$ index.php/anunciants/mostra/$1 这是我的真实代码。
标签: php .htaccess codeigniter mod-rewrite localhost