apache - 在 .htaccess 中重定向时,& 符号被转义
问题描述
我希望 Apache 服务器将 URL 重定向https://frot.io/cv
到https://latexonline.cc/compile?git=https%3A%2F%2Fgithub.com%2Ffrot-io%2Fcurriculum-vitae&target=main.tex&command=xelatex
,因此在 .htaccess 中插入了一个Redirect语句:
RewriteEngine On
RewriteBase /
# Redirect to https
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
# Redirect frot.io/cv
Redirect 301 "/cv" "https://latexonline.cc/compile?git=https%3A%2F%2Fgithub.com%2Ffrot-io%2Fcurriculum-vitae&target=main.tex&command=xelatex"
但是,这会重定向到https://latexonline.cc/compile?git=https%3A%2F%2Fgithub.com%2Ffrot-io%2Fcurriculum-vitae%26target%3Dmain.tex%26command%3Dxelatex
(两个与号和等号被转义),这会导致错误。
如何防止 apache 转义 URL 中的 & 符号?
我也试图逃避那些(%26
和%3D
),但也被错误地重定向了。
解决方案
我在支持人员的帮助下解决了这个问题:
RewriteEngine On
Redirect 301 /cv https://latexonline.cc/pending?git=https%3A%2F%2Fgithub.com%2Ffrot-io%2Fcurriculum-vitae&target=main.tex&command=xelatex
RewriteBase /
...
推荐阅读
- antd - 如何去除 Ant Design 的 Tabs.TabPane 顶部的空间?
- java - Android Studio模拟器在打开应用程序时出现白屏
- javascript - 如何在 redux 钩子中检查 dispatch 的返回值
- php - 发送请求 Web 服务时 PHP 中出现 Curl 错误 56
- google-cloud-platform - 想要通过 terraform 为服务帐户分配多个 Google 云 IAM 角色
- python - 从注释访问原始数据而不创建时期
- sql-server - Spring Data @Query中的SQLServer concat问题
- c# - 将表达式引用解析为实际值
- c# - 如何使用 c# 在 Unity 中仅修改 1 个维度?
- wordpress - 是否可以不在 wordpress 的特定页面上加载主题?