其中带有锚标记(片段ID)的Apache httpd服务器重定向URL

时间:2019-06-24 11:04:50

标签: apache redirect httpd.conf

我正在apache http服务器2.2.34的conf.d / ssl.conf中设置重定向,以查找其中带有锚标记的URL,但是如果RewriteRule的目标URL中存在锚标记,则不会重定向。 >

我有一组带有不同锚标记的网址,并且想要将每个网址重定向到一个新的网址,例如 1)https://example.com/index.php#version-test-> test.example.com/test.php 2)https://example.com/index.php#version-beta-> beta.example.com/beta.php

这是未重定向的httpd.conf代码,

RewriteEngine on
RewriteRule "^/index.php#version-test" "test.example.com/test.php" [NE,R=301,L]
RewriteRule "^/index.php#version-beta" "beta.example.com/beta.php" [NE,R=301,L]

但是,如果我移除其中的锚标签

  

RewriteRule“ ^ / index.php”“ test.example.com/test.php” [NE,R = 301,L]

其正确重定向到test.example.com/test.php。

在处理带有锚标记的网址时是否有特殊情况?还是我在这里想念东西?

0 个答案:

没有答案
相关问题