【发布时间】:2013-04-26 06:32:30
【问题描述】:
我在 WAMP 上使用 CodeIgniter。
Apache 的 Mod_Rewrite 模块被加载。
我的 CI 项目位于 C:\wamp\www\store
我已经从 Codeigniter URL 文档 (here) 中复制了重写规则:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
我要打开的链接是localhost/store/city
在我看来,这条规则永远不会触发。当我尝试打开上述地址时,我收到了我的浏览器(不是 CI)的默认 404 并且似乎没有发生重写。
如果我加载 localhost/store/index.php/city 会加载正确的页面。
为什么我的规则不会触发?
【问题讨论】:
-
如果 .htaccess 位于
/store目录,我猜你必须在 RewriteEngine 之后添加一个 RewriteBase 指令,例如RewriteBase /store,用于工作
标签: php .htaccess codeigniter mod-rewrite wamp