.htaccess mod_alias 和 mod_rewrite 重定向被忽略
我想将所有请求重定向到我的index.php
脚本,这样http://mysite/
之后的所有内容都会通过到 index.php
作为 url 参数。例如,http://mysite/moo.css
应变为 http://mysite/index.php/moo.css
和 http://moosite /moo/foo/bar/
应该变成 http://index.php/moosite/moo/foo/bar/
。
容易吧?
但不是 RedirectMatch (.*) index.php/$1
,也不是 RewriteRule ^(.*)$ index.php/$1 [R,L]
(或其他正则表达式,例如RewriteEngine on
被未忽略;mod_rewrite
和 mod_alias
已启用)已生效。
这是怎么回事?
I want to redirect all requests to my index.php
script in such a way that everything that goes after http://mysite/
would passed to index.php
as url-argument. For example, http://mysite/moo.css
should become http://mysite/index.php/moo.css
and http://moosite/moo/foo/bar/
should become http://index.php/moosite/moo/foo/bar/
.
Easy, huh?
But not RedirectMatch (.*) index.php/$1
, nor RewriteRule ^(.*)$ index.php/$1 [R,L]
(or others regexp like that; RewriteEngine on
was not ommitted; mod_rewrite
and mod_alias
are turned on) took effect.
What's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在不了解更多信息的情况下,我的猜测是该目录缺少
Allowoverride
指令。 (队长风格的答案很明显,但仍然容易被忽视)。Without knowing anything more, my guess would be that the
Allowoverride
directive is missing for that directory. (Captain obvious style answer, but still easy to overlook).