用户帐户的 URL 重写

发布于 2024-09-02 00:22:04 字数 492 浏览 2 评论 0原文

目前,我们将domain.com/username 重定向到domain.com/setsession.asp?u=username,然后重定向到domain.com/theapp 上的应用程序。

这意味着用户始终会看到domain.com/theapp,因此浏览到的页面会显示domain.com/theapp/somepage.asp

希望将其移动到子域

username.domain.com

(我们将获取主机名并从中找出用户)。如何设置?我们是否应该将应用程序本身移至 theapp.domain.com,然后将 username.domain.com 重写为 theapp.domain.com 并且一切正常?

如果是这样,我们如何进行 URL 重写(通过 ISAPI Rewrite for IIS 或 URL Rewriting for IIS 进行 mod_rewrite)以便我们仍然可以访问 webmail.domain.com 等?

We currently have domain.com/username redirected to domain.com/setsession.asp?u=username which then redirects to the app at domain.com/theapp.

This means users always see domain.com/theapp, so browsing to a page shows domain.com/theapp/somepage.asp

Looking to move this to subdomains ie

username.domain.com

(we'll get the host name and work out the user from that). How can this be set up? Should we move the app itself to say theapp.domain.com and then rewrite username.domain.com to theapp.domain.com and everything works?

If thats right, how can we do the URL rewrite (mod_rewrite via ISAPI Rewrite for IIS or URL Rewriting for IIS) so that we can still access webmail.domain.com, etc?

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

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

发布评论

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

评论(1

英雄似剑 2024-09-09 00:22:04

如果您只想将 domain.com/username 移动到 username.domain.com,您可以使用 mod_rewrite 执行此操作:

RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule .* http://domain.com/setsession.asp?u=%1 [B,R=permanent]

If you just want to move domain.com/username to username.domain.com, you can do this with mod_rewrite:

RewriteCond %{HTTP_HOST} ^([^.]+)\.domain\.com$
RewriteRule .* http://domain.com/setsession.asp?u=%1 [B,R=permanent]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文