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?


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)


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.


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..

Your Answer

