Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subdomain redirecting to another server

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

like image 845
Samuel Bolduc Avatar asked May 31 '13 15:05

Samuel Bolduc


People also ask

Can subdomains point to different servers?

Yes, It's possible. For Example. You would either Contact your Host to set this, or if you have the ability to point DNS your self then do so. Just make sure that the site you want to serve on that subdomain exists on the server that it's pointing to.

How do I change a subdomain redirect?

Under Modify a Subdomain, locate the domain you want to redirect, then click its Manage Redirection link on the right. In the text box, type the URL you would like visitors to be redirected to if they go to the subdomain sample1.hgexample.com. Click Save. You will see the redirected URL under the Redirection column.

What is subdomain redirection?

Redirecting a subdomain You can redirect web site visitors from a particular subdomain to another location. This feature is often used when the subdomain's web pages have moved to a new location. For example, you might redirect the sales.example.com subdomain to the salesnew.example.com subdomain.


1 Answers

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.

like image 178
David Levesque Avatar answered Oct 24 '22 18:10

David Levesque