如果查询字符串未完整给出,则重定向到 URL

发布于 2025-01-16 20:15:17 字数 438 浏览 2 评论 0原文

如果查询字符串不完全可用,我想为 Apache 构建重写规则条件。以下是场景:

这是工作 URL 格式 -

https://<base_url>/redirect_uri#state=<value>&token=<value>

如果 URL 类似于 https:///redirect_uri,我想重定向到登录页面。

我尝试如下,但无法识别参数

RewriteCond %{QUERY_STRING} !^#state [NC]
RewriteRule ^/redirect_uri$ https://<base_url>/login [R=301,L]

请帮助我纠正条件以识别参数

I wanted to frame Rewrite rule condition for Apache if the query string is not completely available. Below is the scenario:

This is the working URL format -

https://<base_url>/redirect_uri#state=<value>&token=<value>

If the URL is coming like https://<base_url>/redirect_uri, I wanted to redirect to the login page.

I tried as below which is not recognizing the parameter

RewriteCond %{QUERY_STRING} !^#state [NC]
RewriteRule ^/redirect_uri$ https://<base_url>/login [R=301,L]

Please help me to correct the condition to recognize the parameter

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文