我可以使用 DNS 或 .htaccess 将子域重定向到其他站点吗?
我们刚刚移动了网站的邮件服务器。我们使用 Plesk 作为 Apache 服务器上的接口。
mail.example.com 曾经是邮件服务器的名称,但现在不再是这样了。
我们希望 mail.example.com 现在转发到新的网络邮件地址 http://webmail.com/xxx /example.com
由于这个子域在任何意义上都不再存在,有什么方法可以使用 DNS 记录或 .htaccess 将 mail.example.com 重定向到 http://webmail.com/xxx/example.com?
我能想到的唯一方法是在 Plesk 中设置子域,除了 .htaccess 文件之外没有任何内容,该文件会将所有请求重定向到所需站点。我真的不想仅仅为了重定向目的而设置“假”子域。
有人对如何做到这一点有任何建议吗?
We just moved mail servers for a website. We use Plesk as an interface on an Apache server.
mail.example.com used to be the name for the mail server, but it is no longer the case.
We want mail.example.com to now forward to the new web mail address http://webmail.com/xxx/example.com
Since this subdomain doesn't really exist in any sense anymore, is there any way I can use DNS records, or .htaccess to redirect mail.example.com to http://webmail.com/xxx/example.com?
The only way I can think of to do this is set up the subdomain in Plesk with no content except for a .htaccess file that will redirect all requests to the desired site. I really do not want to have a 'fake' subdomain set up just for redirecting purposes.
Does anyone have any suggestions on how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DNS 无法执行 HTTP 重定向。这就像要求电话簿为您订披萨一样。您仍然需要为 mail.example.com 主机名配置一个网站,并将网络服务器重定向到新地址。在 Apache 中,这很简单(语法让我费尽心思):
另一个选择是让 mail.example.com 的 DNS 记录简单地提供 webmail.com 站点的 IP 地址。但是,您需要配置该站点以接受 mail.example.com 作为别名,并在那里进行重定向,以便用户看到新地址。
DNS cannot do an HTTP redirect. That's like asking a phone book to order you a pizza. You'd still need to have a website configured for the mail.example.com hostname, and have the webserver redirect to the new address. In Apache it's trivial (going off the top of my head for the syntax):
Another option would be to have the DNS record for mail.example.com simply serve up the IP address of the webmail.com site. But then you'd need to configure that site to accept the mail.example.com as an alias and do a redirect there so the user sees the new address.