Instant Sub Domains for your blogging or CMS service using Free Wildcard DNS.
What is a DNS wildcard
For the beginner, to put it in simple words, It is when all the sub domains under a domain name point to a certain IP address in advance, therefore, when a sub domain is added as a virtual host on your web server or in your application, there is no delay due to the usual propagation etc.
Negative caching in DNS means that if you do not have wildcard records, and a request is sent to the nameservers for an address, the name server will have a negative cache (That host does not exist), and propagation delay will occur, More to that, Most name servers take time (Without a wildcard) to refresh there data from the zone files/Database unless you run that DNS server and flush or restart it.
So, down to the Wildcard, Before i tell you how to use the free WildCard service from EasyWebDNS an introduction may be appropriate.
You may be developing a blogging or CMS service, and with that service you may be wanting to offer sub domains to the users, Or you may also want to allow them to use there own domains, here is how you can do that. This tutorial is composed of 3 parts, the first is setting up your server, Second part on how to setup Wildcard DNS and a third on how to setup your PHP application (You can adapt it to other languages as you please). So, if you are planning on such a project i will assume you already have a good background about how the internet works and therefore i will skip the basics and get straight to the issue.
You probably know much of the following, but to reach a wider audience i will need to introduce the problem (DNS propagation) and how this solution overcomes it.
the internet works by Addresses, Numerical ones, So domain names are really nothing but names of addresses, So your domain example.com is really just pointing to a number of the format xxx.xxx.xxx.xxx (This is the human readable format, other formats for the same number exist).
An address keeper that instructs your browser to the current address the domain name points to is called a DNS server, once you change your address, people who have already asked about the address before need time to forget it (TTL or Time To Live) so they will only get it from the address keeper (DNS server) when they forget it (There cache expires).
Now the address keeper is not very instant either, he answers people from the address book he made hours ago before the last refresh, So even if you change your records at the address keeper, he will want to take his time in fixing your entry in his address book, this also applies when you add new addresses.
If you ask the DNS server (Address Keeper) about a domain or sub domain and it does not exist, Your browser will remember for some time that the address does not exist and therefore propagation delay can also happen in this case.
The solution here is a simple one, You will instruct the DNS server (Address keeper) to respond with the same IP for inquiries about your domains or sub domains, so if you point your browser to anyrandomsubdomains.example.com the address keeper DNS server should respond with your IP address, Simple is it not ?
The ability to point all sub domains to one IP address is called Wildcard DNS, if you have a background in DOS or Linux you probably remember what the * wildcard is, so this wildcard is *.example.com and means any sub domain under example.com.
What you will need
1- A Domain name you want to offer the subdomains under (For the example we will use example.com). 2- A DNS service that offers the ability to use wildcard domains (Like the free DNS service from easywebdns.com) 3- A hosting account that listens to a certain IP address, Meaning that you can access the website by its IP address. 4- A server side programming language, In our example i will assume PHP (But any will do).
Part 1- Hosting Setup
To allow your hosting setup to make use of Wildcard DNS and allow you to make an application where you can give away sub domains to host your application, You will need one of the following
A shared hosting account with a dedicated IP, a dedicated Server or a Virtual Private server, this depends on how many clients will use your application and how much resources your application will require, you can always start with the shared hosting account and move up as needed, In summary you will need a dedicated IP address regardless of the hosting platform.
1- Shared hosting, you can buy a shared hosting plan with a dedicated IP from right on this website, In this example that assumes you will want to develop your application in PHP, you will probably want to get a Linux account, the first plan should do just fine for a small application, remember to add a dedicated IP address to it.
Once you have that account, and you know what your dedicated IP address is, You can move to the next step to setup the domain names to point them and all there sub domains to that IP address.
2- Domain Name DNS setup
Your Domains
You can offer your users automatic instant sub domains under a single or many domains, But you need to own the domain and have access to its DNS, EasyWebDNS offers the DNS management for free and supports a wildcard domain for free as well. How to use them is fairly simple.
1- Buy the domains you want to offer Sub Domains under (One or more)
2- From here, Hover your mouse over Domain Names and then from the drop down menu go to My Domain Names, Click on the domain you wish to offer SubDomains under.
3- Look at the information the domain to make sure your domain is pointed to the EasyWebDNS domain name servers (Ending with DOMAINCONTROL.COM)
If your domain already had the DOMAINCONTROL nameservers, (The Default when buying a domain) skip and go to step 5, if not, we need to change them back in the next step.
4- (Only if they are not already set to Domain Control) Go to the nameservers button close to the top
Then, from the choices displayed pick Parked nameservers, then hit the ok button, You will now need to wait around 5 minutes before you can continue the setup process. During the 5 minutes the system might log you out so you may need to log in again.
5- Click the Total DNS control And MX records link to edit your DNS config for that domain name.
6- As you can see, an A record with the host @ (The root host with no sub domain) is already in place, you will need to edit this to your own server address by clicking the button with the pencil on it, In the space that appears you will need to replace the IP address with your own.
7- To create the wildcard record for your domain, You will need to click the Add new A record button, then you will will need to enter a * to make all sub domains under this domain point to your IP address by default
In the example above, (The screen shot) replace 192.168.0.1 with your own IP address, you can change the Time to live to a longer interval if you want to speed up your system and you are not expecting to change that domain name soon.
8- Wait for the DNS to update, once you can open anyrandomsubdomain.example.com and see the files on your hosting account, you are ready to start developing your application.
3- PHP Setup for Multi Domain
So, now we need to get our application to distinguish between the websites when they are all pointing to the same IP address, they will all open our PHP application, but we want the content to be different for every domain, We want the users content to display not ours.
For this purpose, PHP provides the $_SERVER["HTTP_HOST"] global variable, you can use this variable to make your application discriminate between domains used in the browser to access your application.
So, how does this work.
Let us assume you are making a blogging service, A database table will probably have a list of domains that have blogs, so
joe.example.com has the id 1
sweet78.example.com has the id 2
anaconda.example.com has the id 3
So, if $_SERVER["HTTP_HOST"] reports joe.example.com your application can ask the database what the ID of this domain is and get the data related to that name, and then displays it in any way it needs.
Simple is it not ?
Cheers, and have fun
![]() |
|
![]() |
|
| .COM | $ 7.49 |
| .NET | $ 6.49 |
| .ORG | $ 7.49 |
| .INFO | $ 1.99 |
| Compare Pricing | |
| Cheap Domains | |