IfModule不会出现是工作? [英] IfModule doesn't appear to be working?

查看:218
本文介绍了IfModule不会出现是工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我用这样的:

<IfModule mod_rewrite.c>
RewriteEngine On
RedirectMatch 301 ^/training/(.*) /faculty/training.html
</IfModule>

在重定向不会发生。

the redirects don't occur.

同样的,

<IfModule mod_rewrite>
...
</IfModule>

不过,这种按预期工作:

However, this works as expected:

RewriteEngine On
RedirectMatch 301 ^/training/(.*) /faculty/training.html

在换句话说,重定向正常工作之外的&LT; IfModule&GT;

In other words, the redirect works fine outside of the <IfModule> block.

还有一个原因,为什么&LT; IfModule&GT; 就无法检测mod_rewrite.c

Is there a reason why <IfModule> wouldn't detect mod_rewrite.c?

推荐答案

RedirectMatch 指令是一部分 mod_alias.c ,而不是 mod_rewrite.c ,您希望您的IfModule检查mod_alias.c。你也不需要打开RewriteEngine叙述,因为RedirectMatch不使用它。

The RedirectMatch directive is part of mod_alias.c and not mod_rewrite.c, You want your IfModule to check for mod_alias.c. You also don't need to turn on RewriteEngine since RedirectMatch doesn't use it.

这篇关于IfModule不会出现是工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆