apache - Apache httpd server redirect url with anchor tag(fragment id) in it
问题描述
I'm setting up redirects in conf.d/ssl.conf of apache http server 2.2.34 for urls with anchor tag in it but it's not redirecting if the anchor tag is present in the target url of RewriteRule.
I have set of urls with different anchor tags in it and want to redirect each to a new url, like 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
Here is the httpd.conf code which is not redirecting,
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]
howerver if i remove anchor tag in it
RewriteRule "^/index.php" "test.example.com/test.php" [NE,R=301,L]
its redirecting properly to test.example.com/test.php.
is there any special case on how to handle urls with anchor tag in it? or am i missing something here?
解决方案
推荐阅读
- python - 从主函数 Python 更新类对象
- scala - Scala WSClient - 如何使用“源”发布文件和地图
- javascript - 如何在谷歌应用脚本中部分更改文件名?
- shell - awk 或其他 shell 将分隔列表转换为表格
- flutter - AppLifecycleState.paused 上的执行保证?
- anylogic - 有没有办法(轻松)使用文本编辑器而不是图形来进行交通逻辑?
- python - Seaborn jointplot kde 在 Jupyter 上不起作用
- r - 将字符日期更改为数字日期,然后在数据框中提取年份
- bash - 无法找到实时磁盘性能数据 [UBUNTU 18.04]
- node.js - GCP Gitlab CI Cloud Function NodeJs 部署失败:RESOURCE_ERROR 400