apache 2.4,mod_rewite,htaccess:<IF>

问题描述 投票:0回答:1

从退休管理员那里继承了一个问题。我们有 1900 多行 .htaccess,我必须首先进行整合。

而不是写700次 重写条件 重写规则 我想根据 HTTP_HOST 将请求分组为 语句的部分:

RewriteEngine On
RewriteOptions Inherit
<If "%{HTTP_HOST} == 'www.my-domain.com'">
  RewriteRule ^hta-test(/(index\.php)?)?$   https://www.hmy-domain.de/de/RewriteRule.php [NC,R=301,L]
</If>

但是 RewriteRule 没有被执行。如果我使用“RewriteMatch”,这是有效的(这告诉我“”通常有效)。但“L”标志的功能不存在但必需。

如何使 中的“RewriteRule”在 Apache 2.4.9 CentOS 7.9 中工作?
或者 mod_alias 中有类似的功能吗?

亲切的问候 疯子_

PS:我知道,1900行htaccess是垃圾。

apache if-statement mod-rewrite url-rewriting
1个回答
0
投票

httpd.apache.org/docs/trunk/mod/mod_rewrite.html#rewriterule:每个目录重写:* If 块遵循目录上下文的规则。

我的错,不理解文档。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.