Dynamically Create Sub Domains in Coldfusion

I would like to know how to dynamically create sub-domains in Coldfusion.  What i'm looking to do is build out personalized URLs based on a database.  
For example:
variable1.mydomain.com
variable2.mydomain.com etc...
Then if someone types variable1.mydomain.com it will present that user specific information related to that sub-domain.  My guess is to analyze the domain in CF and parse the text before .mydomain.com and then set the variable.  Obviously in my DNS records I will have *.mydomain.com point to the website's IP.

 Is this the right way to go about this?  Any other thoughts?  Thanks!
tags266Asked:
Who is Participating?
 
ajarveyCommented:
Yes, you most certainly can. It's just that anything that doesn't have a defined host header, will default back to that particular website. So long as you setup a host header for all your other domains accordingly, the way I've explained the IIS setup will work just fine for what you're trying to do.
0
 
ajarveyCommented:
That is exactly right. So long as your website is setup on a static IP address, this will work correctly. You will then create the wildcard DNS entry to point *.yourdomain.com to the static Ip address that your website is set to run on in IIS. Without the static IP address, this type of setup will not work. IIS will try to respond to the host header of variable1.domain.com, see that it doesn't exist, then throw an error.
0
 
tags266Author Commented:
Should I set up my host header in IIS as *.mydomain.com  rather than mydomain.com ?
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
ajarveyCommented:
You should setup a blank host header, with the static IP address you are utilizing. If you went the routs of host headers, you would need to have one defined for each possible variable out there.
0
 
tags266Author Commented:
Ok, so i'm assuming I can't use other sites (with host headers) on that IP address correct?  
0
 
tags266Author Commented:
Thanks ajavey - You've been most helpful.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.