• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 173
  • Last Modified:

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!
0
tags266
Asked:
tags266
  • 3
  • 3
1 Solution
 
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
 
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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
tags266Author Commented:
Ok, so i'm assuming I can't use other sites (with host headers) on that IP address correct?  
0
 
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
 
tags266Author Commented:
Thanks ajavey - You've been most helpful.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now