gpt4 book ai didi

Apache mod_rewrite 重定向 : ampersands in new query string being transformed incorrectly

转载 作者:行者123 更新时间:2023-12-01 13:48:58 25 4
gpt4 key购买 nike

我需要使用 Apache (2.2.31) mod_rewrite 重写一个 URL,以便 page.html 变成 another.html?a=one&b=two&c=three。如果存在与 page.html 关联的查询字符串参数,则应忽略它们。我正在尝试这个:

RedirectMatch ^/page.html.*$ "/another.html?a=one&b=two&c=three"

...执行重定向,但正在转换与符号字符,以便重定向的 URL 如下所示:

/another.html?a=one/page.htmlb=two/page.htmlc=three

我尝试用 %26 替换重定向规则查询字符串中的 & 字符,但重定向的 URL 按字面显示它们。

mod_rewrite 有很多选项,我在文档中找不到解决方案。

最佳答案

事实证明,我所要做的就是使用反斜杠字符转义重写规则中的每个与号,例如\&

关于Apache mod_rewrite 重定向 : ampersands in new query string being transformed incorrectly,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33395373/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com