重写子域名但保留url

发布于 2025-01-06 07:45:13 字数 441 浏览 3 评论 0原文

我有一个网站在domain.com,它有一个登录页面在domain.com/user/login。 我希望 login.domain.com 显示登录信息,但仍具有 url login.domain.com。

我现在拥有的:

RewriteCond %{HTTP_HOST} ^login.domain.nl$ [NC]
RewriteRule (.*) http://domain.nl/user/login$1 [L]

但这也会更改网址,如果我将其更改为:

RewriteCond %{HTTP_HOST} ^login.domain.nl$ [NC]
RewriteRule (.*) http://domain.nl/user/login$1 [P,L]

我得到 400 ..

我做错了什么?

I have a website at domain.com, it has a login page at domain.com/user/login.
I would like login.domain.com to show the login but still have the url login.domain.com.

what i have now:

RewriteCond %{HTTP_HOST} ^login.domain.nl$ [NC]
RewriteRule (.*) http://domain.nl/user/login$1 [L]

but this changes the url as well and if i change it to:

RewriteCond %{HTTP_HOST} ^login.domain.nl$ [NC]
RewriteRule (.*) http://domain.nl/user/login$1 [P,L]

i get a 400..

what am i doing wrong?

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

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

发布评论

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

评论(1

美胚控场 2025-01-13 07:45:13

这个问题是在错误的部分,但是,您不一定可以像您想要的那样调用远程页面(即使使用代理标志),您需要进行本地引用。

您需要执行以下操作:

RewriteCond %{HTTP_HOST} ^login.domain.nl$ [NC]
RewriteRule (.*) /user/login.php?arguments=$1 [QSA,L]

引用文件的本地位置。

This question is in the wrong seciton, however, you can't necessarily call the remote page like you want to (even using the proxy flag), you need to make a local reference.

You need to do something like:

RewriteCond %{HTTP_HOST} ^login.domain.nl$ [NC]
RewriteRule (.*) /user/login.php?arguments=$1 [QSA,L]

That references the local location of the file.

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