WebsiteGear Logo Log In
New User? Sign Up
About | Contact | FAQ
  Home Content Web Hosting Tuesday, October 13, 2015 
Print| Email| Save| Discuss| Feeds

Subdomain Configuration
Published: Monday, August 16, 2004

Subdomain Configuration
A subdomain configuration is very similar to a domain name configuration. The only difference is that the subdomain entry is tied to the corresponding domain name lookup. A request for the subdomain (e.g. will be routed to a DNS server containing the DNS information for the parent domain ( Once the DNS record for the subdomain is resolved to a particular IP address, the request is sent to the web server listening on that IP address. The web server can now delegate the request to the particular website based on the subdomain name in the host header of the request object. Various combinations of subdomain configurations are possible by using DNS server entries and web server application setup for load distribution, application isolation or security purposes.

Subdomain Setup on DNS server
The forward lookup zone of the parent domain in the DNS server should contain a pointer to the sub domain using either an alias (CNAME), a hostname (A) or a mail enchanger (MX) entry. The alias (CNAME) record is used for a subdomain if the subdomain points to a website running on the same web server at the same IP address as the parent domain website. A new hostname (A) record is used if the subdomain points to a different web server, or to the same web server listening on a different IP address (as in the case of load distribution).

Alias (CNAME) Setup: An alias points the subdomain to the same web server, which hosts the website for the parent domain. The canonical names (CNAMES) are added for each of the subdomains as shown below. Once the subdomain is resolved to the IP address of the web server, the web server can route the request to a different website (see section on web server setup below). Note that an alias for www is setup as a subdomain by default by most hosting companies, so that requests to is sent to the same website that handles the requests for

subdomain1 IN CNAME
subdomain2 IN CNAME

Address (A) Record Setup: A hostname DNS entry is required if the subdomain is pointing to a different IP address than that set for the domain name. Add the address (A) records to the forward lookup zone of the parent domain and associate the address records with the IP addresses of the web servers, which will handle the requests for the subdomain.

subdomain1 IN A
subdomain2 IN A

Mail Exchanger (MX) Setup: The mail exchanger subdomain configuration is required if an email server is setup to handle the subdomain mail accounts. For example, an email address like will require a subdomain setup for resolving the mail server for The setup is similar to the CNAME setup but with MX records.

subdomain1 IN MX 10
subdomain2 IN MX 10

Note: If the sub-domain is configured on another DNS name server, a Name Server (NS) record has to be created for the sub-domain on the corresponding domain name DNS server, so that it can delegate the sub-domain lookup to the other name servers. Using different name servers can eliminate security issues in cases where the sub-domains are maintained by separate administrators. However, the lookup carries an additional overhead.

Configuring the web server for sub-domains
Once the DNS server is setup to send the request for the sub-domain to the corresponding IP address, the work of the web server begins. The web server needs to be configured appropriately to handle the request for the sub-domain based on either the IP address or the host header entry. Host headers are commonly used by web servers to host multiple domains or sub-domains on one IP address.

Microsoft Windows IIS : In case of Internet Information Server (IIS), create a new web site for the subdomain using the IIS Manager, and add the sub-domain (e.g. as a new host header value listening to the same IP address as specified in the DNS entry. The port is set to 80 (the default for http requests). The host header can be added by clicking on the advanced tab next to the IP address configuration for that web site application. If the subdomain points to a subdirectory of the web site for the domain, then set the home directory for the subdomain web site to the subdirectory. For example, if the points to C:\Inetpub\wwwroot\ and the subdomain needs to be setup for C:\Inetpub\wwwroot\subdomain, then the directory for the subdomain website should be set to C:\Inetpub\wwwroot\subdomain.

Apache Web Server : In case of Apache web server, the subdomain is configured by virtual host entries in httpd.conf as shown below.

Listen 80
NameVirtualHost *

<VirtualHost *>
DocumentRoot /home/httpd/htdocs/

<VirtualHost *>
DocumentRoot /home/httpd/htdocs/subdomain/

Sub-domain configuration starts with an entry in the DNS server of the parent domain and the lookup resolves the sub-domain to an IP address of the web server. The web server in turn delegates the requests based on its configuration for the sub-domain. Various sub-domain configurations can be used effectively to distribute the load evenly among available web applications or web servers listening to different IP addresses. The load distribution is achieved by the DNS round robin feature of the BIND. Other uses include application isolation, simpler and professional looking URL, content categorization etc.
Previous Article Tips On Using SubDomain
Print| Email| Save| Discuss| Feeds
Nav SubDomain - The Third Level Domain
A subdomain is the part of the website address before the domain name. Learn about using subdomain names.
Nav Introduction To Server Load Balancing
Load balancing applies to all types of servers (application server, database server), however, we will be devoting this section for load balancing of web servers (HTTP server) .
News Post Auto-Ranging Feature Adds Flexibility to Intepro's Programmable DC Power Supplies
General purpose panel-mounted units offered with output ratings up to 3kW; industry-best efficiency reduces energy and cooling costs; auto-ranging feature facilitates wide range of test conditions
News Post ScaleOut Software Positioned as a Strong Performer of In-Memory Data Grids by Major Independent Research Firm
ScaleOut StateServer® In-Memory Data Grid Noted as "Pleasurably Easy to Implement"
News Post Lawn Care Equipment Manufacturing, including Lawn Mowers Industry (U.S.): Analytics, Extensive Financial Benchmarks, Metrics and Revenue Forecasts to 2022, NAIC 333112
LONDON, Oct. 13, 2015 /PRNewswire/ -- Vital industry-specific data including metrics, benchmarks, historic numbers, growth ra...
News Post Generators, and Wind, Steam and Gas Turbine Equipment Manufacturing Industry (U.S.): Analytics, Extensive Financial Benchmarks, Metrics and Revenue Forecasts to 2022, NAIC 333611
LONDON, Oct. 13, 2015 /PRNewswire/ -- Vital industry-specific data including metrics, benchmarks, historic numbers, growth ra...
News Post Machine Tool and Laser Manufacturing (for Bending, Buffing, Boring, Pressing, Grinding or Forming) Industry (U.S.): Analytics, Extensive Financial Benchmarks, Metrics and Revenue Forecasts to 2022, NAIC 333517
LONDON, Oct. 13, 2015 /PRNewswire/ -- Vital industry-specific data including metrics, benchmarks, historic numbers, growth ra...
Submit News | View More NewsView more news
Classified Ad ClubVPS – True Cloud In New York/Hong Kong/IL/Am" provide reliable, professional, High Availability Cloud ...
Classified Ad Looking for a Sr. Software Engineer in Vadodara
Sanah Infosolutions , Vadodara ( is looking for Sr. Software Engineer for its Cl ...
We have developed HTML Tagging Conversion software which can convert any TIFF Frech Srcipt Image to ...
Classified Ad The Future of Hosting is VPS Hosting
Virtual Private Server hosting is getting popular by the day and seeing the rise in demand shared ho ...
SQL School is one of the pioneers IT Institutions providing specialized in SQL Server 2012 DBA Train ...
Post Free Ad | View More View more classifieds
Forum Post Strange problem with domain name configuration
We have a few domain names registered with Network solutions. Recently, we changed web hosts. In t ...
Forum Post Configuring BIND on windows 2003 server VPS
Hi Guys, I have a Windows 2003 Virtual Private Server and I'm trying to configure it with a BIND ...
Forum Post Parent servers say that the domain does not exist
I have a certain question related to DNS configuration: 1) a week ago my internet domain SKARBIEC ...
Forum Post 8 Steps to Choosing the Right Web Host
Here is an article I wrote a while ago but figured I would share this with other people for their co ...
Forum Post DIY photo collage yearbook with digital photos
Christmas is coming and a year also comes to its end right away. From beginning to end, from spring ...
Add New Post | View More View more forum posts
Nav How To Sell A Website
Nav Subdomain Configuration - How To Setup A Sub Domain
Nav Website Layout - Tips & Tricks
Nav Domain Configuration - How To Setup A Domain Name
Nav Round Robin DNS Load Balancing
Nav Introduction To Server Load Balancing
Nav Website Traffic & Revenue
Nav Tips On Using SubDomain
View More News View More News