gpt4 book ai didi

apache - apache .htaccess 中的主题标签

转载 作者:行者123 更新时间:2023-12-04 09:12:51 24 4
gpt4 key购买 nike

通过使用以下 .htaccess

RewriteEngine On
RewriteRule ^([0-9]+)/([0-9]+)$ /api/web/index.html#$1/$2 [R=301,NC,L]

当用户在浏览器中输入以下 URL 时。
http://localhost:8080/1/2

我期待,Apache 将执行内部重定向,并更改浏览器中显示的 URL(通过 R=301)。
http://localhost:8080/api/web/index.html#1/2

更改浏览器中显示的 URL 很重要。这是为了确保 index.html的 JavaScript 可以正确解析 url。

然而,我真正得到的是
http://localhost:8082/api/web/index.html%231/2

我会收到 Apache 错误。

Apache 错误地认为,我希望获取一个名为 2 的文件。位于目录 api/web/index.html%231/
有什么我可以通过修改 .htaccess来解决这个问题的吗?只要?

最佳答案

#被编码为 %23 .尝试使用 NE在您的规则中标记:

RewriteRule ^([0-9]+)/([0-9]+)$ /api/web/index.html#$1/$2 [R=301,NC,L,NE]
NE标志告诉 mod_rewrite 不要对 URI 进行编码。

关于apache - apache .htaccess 中的主题标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23534318/

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