Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So here's the deal:

  • 1 domain (example.com)
  • 2 shared hosting plans (for each, all domains and subdomains have the same IP address)

I've already set up sub1.example.com to point to the IP (using A) of the second host and it works.

Now what if I want to point sub2.example.com to the same host, but different folder? I can't point to the same IP. Is there a way around it? Or do I have to get dedicated IPs for each subdomain on the second host?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

DNS translates hostnames to IPs, there is no such thing as a different folder DNS-wise. The translation hostname (or more generally: URL) to folder must be done in your webserver configuration. This is called virtual hosting. (Some problems arise if you need https for several names)

share|improve this answer
add comment

if you use Apache as a webserver, you have to create different <VirtualHost IPADDRESS:80> configs and direct them into a folder with DocumentRoot /var/www/sub2. Check out /etc/apache2/sites-enabled/default on a linux server and most probably C:\xampp\apache\conf\extra\httpd-vhosts.conf on Windows.

share|improve this answer
add comment

There is no reason you cannot point 1000 domains to 1 IP, you just need to configure your web/mail/whatever server to respond to each domain..

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.