1

I do not know anything about this DNS stuff. I don't even know if this should be on stackoverflow or serverfault but anyways...

I have a site at example.com whose IP is 1.2.3.4, I have subdomain at sub.example.com whose IP address is also 1.2.3.4. This site is registered at GoDaddy.

I am assuming that my site is on a virtual host since http://1.2.3.4 shows me a different page than my homepage at http://example.com, and I am on shared hosting

The server is running Apache 2.2

Now I have another domain (my-other-domain.com) which is not registered with GoDaddy and somebody else is managing it. All he asked is for the IP address of the server (which is 1.2.3.4). I want my-other-domain.com to point to sub.example.com. If he makes an A-Record to make my-other-domain.com point to my server's IP which is 1.2.3.4, where will it go? And do I need to edit my A-Records too? Because I am assuming that my site is on virtual host, I do not have the assurance that my nameservers already know for whom my-other-domain.com is!

I do not have access to Apache conf files. Anybody familiar with the GoDaddy control panel?

2 Answers 2

1

The technology in use is called name based virtual hosting. The web server reads the host header from the client request, searches the list of hosts that are on it and then presents the relevant website or a default it a match fails.

You will need to configure your sub.example.com to be an alias for my-other-domain.com. This is most easily achieved through the ServerAlias directive within the VirtualHost definition for sub.example.com

<Virtualhost *:80>

    ServerName sub.example.com
    ServerAlias my-other-domain.com

</VirtualHost>
2
  • I don't think I have access to the configuration files of Apache. Sep 14, 2011 at 7:22
  • You probably need to speak to godaddy to see if they can help.
    – user9517
    Sep 14, 2011 at 7:28
3

You have to understand how DNS and Apache/HTTP relate.

  • If you contact http://1.2.3.4 from your browser, it will contact the server directly and asks for the default document for the site 1.2.3.4, which is usually not your main site on a shared hosting but something the provider configures.

  • If you contact http://example.com, your Browser will ask the DNS for the address example.com (1.2.3.4.) and will then contact the server and asks for the default document for the site example.com, which is your main site.

  • The same is true for sub.example.com, but of course it will ask for the default document for this sub-site.

  • If you now have this other domain my-other-domain.com, your browser will get the same IP as before and ask the server for the default document for this domain, but since Apache doesn't know about a site with this name, it will fall back to the default case as in the first case and will deliver the default document like with http://1.2.3.4 (this is the most likely configuration, but others are possible as well).

As a result, what you need to do is to configure Apache for the new domain. How this is done is largely dependent on the system you are on. It could be some config panel software like Plesk, or the provider would need to do it himself or you could be required to edit a config file manually.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .