I mentioned a while ago I was playing with subdomain redirects for some ATC related domain names I registered. Well, I’ve got them working to the point I’ve started telling people they can be used. The domains in question are:
http://www.airtrainingcorps.info
http://www.atc-sqn.org.uk
http://www.atc-squadron.org.uk
and if you go them you can see more about how it works.
Basically, the www is a commonly used subdomain of internet domain names. Normally it points to a web server that replies with a web page but I made my web server read the the subdomain name and look up another location in a database. If there is another location, the server will tell a visitors web browser to go somewhere else.
Therefore other cadet units can turn addresses like http://www.freehostsite.net/~user879744x1/ into a more readable and logical address like http://1242.airtrainingcorps.info. When the server gets the request for 1242, it will redirect the user to the free hosting web site. The advantages are:
1) If a squadron moves to another free host the rest of the ATC don’t have to update their links to point to the new location (I update my redirect list and visitors automatically get redirected to the new location)
2) It means ATC squadrons get a relevant domain name for their publicity for free (as opposed to buying a domain name for their use and having to manage it).
It was programmed using PHP and MySQL, with a neat DNS trick called Wildcard DNS.