URL 重定向 - 附加到链接末尾

发布于 2024-12-29 23:20:06 字数 488 浏览 2 评论 0原文

我正在使用 Glassfish V3

我目前有用户使用 http://mydomain.com/workbench 访问我的应用程序

我想要这样,如果用户没有放置工作台部分,他们就会被定向到它

'http://mydomain.com' --> 'http://mydomain.com/workbench'

'http://mydomain.com/workbench' (这不应该重定向

'http://mydomain.com/PDA' (这不应该重定向)

我尝试过使用redirct_n 但它没有解决问题;正如我这样做的:

redirect_1 from=/my-app url=http://mydomain.com/workbench

出于明显的原因,这会创建一个无限循环

I am using Glassfish V3

I currently have users that access my application using http://mydomain.com/workbench

I want it so that if the user doesn't put the workbench part that they are directed to it

E.g.

'http://mydomain.com' --> 'http://mydomain.com/workbench'

'http://mydomain.com/workbench' (this shouldn't redirect

'http://mydomain.com/PDA' (this shouldn't redirect)

I have tried using redirct_n but it hasn't solved the problem; as I did this:

redirect_1 from=/my-app url=http://mydomain.com/workbench

for obvious reasons this creates an infinite loop

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

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

发布评论

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

评论(1

妖妓 2025-01-05 23:20:06

这种方法可能不适合你。它适用于状态和错误页面(例如 40x)。如果您需要更复杂的规则,我建议您研究以下解决方案:
+ 从您的应用程序进行 URL 重写 借助周围应用程序的一点帮助(例如,http://ocpsoft.com/rewrite/< /a>)
+ Apache mod_proxy 和 mod_rewrite

Rgds,
马库斯

this approach probably isn't working for you. It's meant for status and error pages (e.g. 40x). If you need more complex rules I suggest looking into any of these solutions:
+ URL Rewriting from your app With a little help from the apps around (e.g., http://ocpsoft.com/rewrite/)
+ Apache mod_proxy and mod_rewrite

Rgds,
Markus

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文