使用 Apache 的 mod_rewrite 创建别名

发布于 2024-09-13 02:36:05 字数 458 浏览 4 评论 0 原文

我需要为一个确切的页面创建一个别名,不幸的是其中有特殊字符。我确实设置了一个环境,因此其他重定向可以正常工作,但这个不行:

RewriteRule ^/ow/email.htm?who=Kate%20Jones&direct=True&[email protected]$    http://www.google.com/ow/lalala.htm

我应该如何重写此语句才能使其正常工作?

附言。这是我第一次来这里,所以如果我没有正确遵循 stackoverflow 政策,请告诉我;)非常感谢!

I need to create an alias for one exact page which unfortunately special characters in it. I do have an environment set up so other redirects work fine, but not this one:

RewriteRule ^/ow/email.htm?who=Kate%20Jones&direct=True&[email protected]$    http://www.google.com/ow/lalala.htm

How should I rewrite this statement so that it works?

PS. This is my first time here so do let me know if I'm not following stackoverflow policy correctly or smth ;) Thank you so much!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你又不是我 2024-09-20 02:36:05

您需要使用 RewriteCond 指令 对于 URI 查询,要么检查 QUERY_STRING

RewriteCond %{QUERY_STRING} =who=Kate%20Jones&direct=True&[email protected]
RewriteRule ^/ow/email\.htm$ http://www.google.com/ow/lalala.htm

或者 THE_REQUEST 中的 rel="nofollow noreferrer">请求行

RewriteCond %{THE_REQUEST} ^GET\ /ow/email\.htm\?who=Kate%20Jones&direct=True&directemail=kate\[email protected]\s
RewriteRule ^/ow/email\.htm$ http://www.google.com/ow/lalala.htm

You need to use the RewriteCond directive for the URI query, either to examine QUERY_STRING:

RewriteCond %{QUERY_STRING} =who=Kate%20Jones&direct=True&[email protected]
RewriteRule ^/ow/email\.htm$ http://www.google.com/ow/lalala.htm

Or the request line in THE_REQUEST:

RewriteCond %{THE_REQUEST} ^GET\ /ow/email\.htm\?who=Kate%20Jones&direct=True&directemail=kate\[email protected]\s
RewriteRule ^/ow/email\.htm$ http://www.google.com/ow/lalala.htm
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文