Subdomain redirecting to another server

孤街醉人 提交于 2019-12-03 08:17:15

问题


I have a website hosted on a shared hosting plan. My domain name is registered at GoDaddy, and the nameservers are those of my shared hosting (so far, all normal).

But I'm trying to figure out how to add a subdomain and point it somewhere else. I would like to point sub.mydomain.com to some other ip (on Amazon AWS). I would like to have it behave like a normal domain, and not a simple header('Location: ...') or window.location.href.

Is this even possible? If so, how do I do?

Thanks


回答1:


Yes it is possible. In the GoDaddy Control Panel, edit your DNS Zone File and add a "A record" for the subdomain. You should already have a A record for your main domain mapped to "@". Add a new entry using the subdomain prefix as host, e.g.:

Host    Points To

@       <main domain IP address>
sub     <subdomain IP address>

The second line should allow you to access the subdomain using sub.mydomain.com, while the main domain will still be accessible using mydomain.com.



来源:https://stackoverflow.com/questions/16860938/subdomain-redirecting-to-another-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!