Posted on : 16-09-2008 | By : Japh
After seeing quite a few websites with dynamic content based on the domain name, I wanted to give it a try to see how difficult it was to achieve.
Here’s what I came up with: DueABootin.com
As it turns out, it wasn’t very difficult at all! (Especially being hosted through WebFaction, they make it even easier!)
First, I added the domain to my control panel, an added a subdomain of “*”, as you can see in the screenshot below.

And that’s really the hardest part, because PHP provides a nice little pre-defined variable called $_SERVER['HTTP_HOST'] which then gives us “example.dueabootin.com”, which we can pull apart and do with what we like.
Update: I’ve had a bit of a look into how difficult it might be to achieve the same results with cPanel, and it’s not much more difficult.
Create a new sub-domain called “*” which does not re-direct, just points to public_html/, and you should be fine. If that alone doesn’t work, then you may need to add an A record to your DNS zone file something like:
*.example.com. 14400 IN A 192.168.1.101
(don’t forget the trailing “.” after “.com”)
No related posts.





Hey Japh!
Gave dueabootin a plug on the squeeze
http://www.thewebsqueeze.com/forum/Web-Design-in-General-f55/How-Is-This-Done-t2782.html
Where’s all the new content at?
Hey mate,
Thanks for that! I’ll definitely have to make some time for posting here more often then!
Just thought I’d come back and give kudos to this post which reminded me of how versaile the information in URL’s can be. Using PHP to take configuration data from the URL helped me in a recent project.
Cheers
I found this via google just now and ended up at thewebsqueeze.com (shame the google search works better then the inhouse search function there) and find this post most useful, and simple.
It is also easy to backup and transfer all your websites from one server to another server if you have cPanel installed~:*