子域映射到另一个外部子域

发布于 2024-07-14 14:05:03 字数 466 浏览 3 评论 0原文

我正在尝试将 help.domain1.com 映射到 help.domain2.com。 我在 UserVoice 上看到过这个。 它们允许您将 Something.yourdomain.com 映射到 Something.uservoice.com。

在domain1.com 上,我设置了一个CNAME 到help.domain2.com。

它工作正常,但是当我打开help.domain1.com时,我得到的是domain2.com而不是help.domain2.com的内容。

经过一些实验后,我意识到这是预期的行为。

所以我的问题是,当我导航 help.domain1.com 时,我必须在domain2.com(或者可能在domain1.com?)上做什么才能让它显示子域“help.domain2.com”的内容?

(我使用的是 Plesk,操作系统是 Windows Server 2003)

I'm trying to map help.domain1.com to help.domain2.com. I've seen this on UserVoice. They let you map something.yourdomain.com to something.uservoice.com.

On domain1.com I've set up a CNAME to help.domain2.com.

It works fine but when I open help.domain1.com I get the content of domain2.com instead of help.domain2.com.

After some experimenting I've realized that this is an expected behavior.

So my question is what do I have to do on domain2.com (or maybe on domain1.com?) to have it show content of subdomain "help.domain2.com" when I navigate help.domain1.com?

(I'm using Plesk and the OS is Windows Server 2003)

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

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

发布评论

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

评论(4

梦冥 2024-07-21 14:05:03

在过去的几天里我遇到了同样的问题,刚刚找到了解决方案...

在 /etc/apache2/site-available/default 中,我有两个虚拟主机,第一个用于我的域,第二个用于我的域用于我的子域。 我所要做的就是颠倒虚拟主机块的顺序,将子域放在域前面,然后就成功了! :D

I was facing the same problem for the last couple of days, and just found the solution...

In /etc/apache2/site-available/default, I had two virtual hosts, first one was for my domain, and the second one was for my sub domain. All I had to do was reverse the order of the virtual host blocks, placing the sub domain in front of the domain, and it worked! :D

烙印 2024-07-21 14:05:03

我找到了解决方案。 一种方法是在domain2.com 上使用mod_rewrite 规则,并在引荐来源网址为domain1.com 时进行重定向。 或者分配一个专用的IP地址。

I found the solution. One way would be to use a mod_rewrite rule on domain2.com and do a redirect if referrer is domain1.com. Or to assign a dedicated IP address.

悍妇囚夫 2024-07-21 14:05:03

如果同一 IP 地址上托管多个站点,HTTP/1.1 使用 Host: 标头来确定正在请求哪个站点。

您需要确保第二个(目标)Web 服务器配置为期望传入的 HTTP 请求中包含原始 URI。

HTTP/1.1 uses the Host: header to figure out which site is being requested, should there be more than one site hosted on the same IP address.

You need to ensure that the second (target) web-server is configured to expect incoming HTTP requests with the original URI in them.

魂牵梦绕锁你心扉 2024-07-21 14:05:03

我不是 100% 确定如何在 Windows 中执行此操作,但在 apache 中,您只需要设置一个虚拟主机即可将其从主域重定向到您的子域。

您没有说明您使用的是 IIS 还是 apache,也没有说明 Web 服务器是什么。

我想您需要做的是在 IIS 中设置一个新网站(不是虚拟目录),然后在网站选项卡中单击“高级”并编辑其中的条目,以便“主机标头名称”是您想要的子域。

乔恩·霍金斯

I am not 100% sure how to do this in windows but in apache you just need to setup a virtual host to redirect it from the main domain to your subdomain.

you do not say if you are using IIS or apache or what the webserver is.

I imagine that what you need to do is setup a new website in IIS (not a virtual directory) and in the website tab click on advanced and edit the entry in there so that the "host header name" is the subdomain you want.

Jon Hawkins

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