RewriteCond 和完整 QUERY_STRING

发布于 2024-09-02 05:30:40 字数 712 浏览 0 评论 0原文

我很难理解这个问题——它应该是微不足道的。

我想将一个带有特定查询字符串的 URL 重定向到另一个 URL。

我想发送在 URL

http:// 中包含查询字符串的任何请求example.com/index.php?option=com_user&view=register

至:

http://example.com/index.php?option=com_regme&view=form&regme=4&random=0&Itemid=6

如果他们在第一个 URL 的末尾添加任何内容,它仍然应该转到第二个 URL,这样他们就无法绕过重定向。第一个查询字符串中的任何内容都不需要保留并传递给第二个查询字符串 - 我只想完全更改 URL。

我正在费尽心思想让它发挥作用,但这应该是微不足道的。

建议?

谢谢,

-蒂姆

I'm having hard time getting my head wrapped around this one - and it should be trivial.

I would like to redirect one URL with a specific query string to another URL.

I want to send any requests that contain the query string in the URL

http://example.com/index.php?option=com_user&view=register

To:

http://example.com/index.php?option=com_regme&view=form®me=4&random=0&Itemid=6

If they add anything to the end of the first URL, it should still go to the second URL so that they cannot bypass the redirection. Nothing in the first query string needs to be preserved and passed to the second - all I want to do is change the URL completely.

I'm tearing my hair out trying to get this to work yet it should be trivial.

Suggestions?

Thanks,

-Tim

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

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

发布评论

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

评论(1

七七 2024-09-09 05:30:40

由于参数可能以任何顺序出现,请尝试以下规则:

RewriteCond %{QUERY_STRING} (^|&)option=com_user(&|$)
RewriteCond %{QUERY_STRING} (^|&)view=register(&|$)
RewriteRule ^ /index.php?option=com_regme&view=form®me=4&random=0&Itemid=6 [L,R=301]

Since the parameters may appear in any order, try this rule:

RewriteCond %{QUERY_STRING} (^|&)option=com_user(&|$)
RewriteCond %{QUERY_STRING} (^|&)view=register(&|$)
RewriteRule ^ /index.php?option=com_regme&view=form®me=4&random=0&Itemid=6 [L,R=301]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文