How to create subdomains and NOT use DNS

Posted on 2006-05-03
Last Modified: 2012-05-05

I would like to be able to create subdomains on our Apache 2 webserver.

I DO NOT want to add these sub domains to our DNS (currently using third party website).

EXAMPLE: <- All requests go here

sub.mydomain <- All requests go to root document for this subdomain WITHOUT using DNS

Here is my current configuration but only works with DNS etries:

DocumentRoot /root/subdir
DirectoryIndex index.html index.htm index.php index.cgi
ErrorLog /var/log/httpd/subdir/error_log
CustomLog /var/log/httpd/subdir/access_log custom env=!object

I hope this question makes sense and I hope this is possible.


Question by:baxleyb
    LVL 27

    Accepted Solution

    > I DO NOT want to add these sub domains to our DNS

    Then you must add a wildcard DNS entry like

    * 172800 IN A IP_goes_here

    Otherwise the request does not reach your server.
    LVL 15

    Expert Comment

    caterham_www is correct - in order for a webpage of a subdomain to be resolved, you need both a dns entry that covers that subdomain, and an apache configuration that covers this domain as well.

    If you do not want to specify out each subdomain, you need a wildcard entry like he has specified, as well as some form of default virtualhost configuration, that will pick up the subdomains.
    LVL 4

    Expert Comment


    also as you said

    I DO NOT want to add these sub domains to our DNS (currently using third party website).
    ======== Than ofcourse you can add your subdomains entry in some remote DNS server that resolve to your apache. It is not necessary to have DNS server on same server. But the DNS server name you add your subdomians must be one of the nameserver define for that Domain...

    i.e. if you domain is hosted on your server with nameserver as and
    and is on your server but belongs to some other server of some hosting company. Than just add your sub-domain DNS entry in there server, and put virtual tag in your apache.

    DNS server are to resolve the name to IP once it is done either by your server or by remote it doesn't matter to a request they will get your subdomains IP thats all they need

    But for simplicity follow what has been said above ...

    Though I am interested to know why you need to do that, if you have a subdomain register it in DNS why you don't want will be interesting...


    Author Comment

    periwinkle,  caterham_www,

    Thanks for your posts. We are currently using DNS to resolve sub-domains but would like the flexibility to NOT use DNS to accomplish this.

    So if I did use a wildcard then would EVERY sub domain attempt to resolve to one ip address?

    What if I had like 5 that should go to different ip addresses? How would that work?

    EXAMPLE: -> ->

    * -> ->




    Author Comment

    Well I found out that I can use a wildcard, but it has been decided to do this at a later time, for now we'll stick with direct to DNS.

    caterham_www, thanks for your advice and response.



    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting ( to http…
    If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now