Reputation: 5586
How can I get the subdomain of a URL using Coldfusion?
For example, say I had the following URL:
How could I get 'support'?
Is there a built in function to do this?
Upvotes: 4
Views: 1608
Reputation: 61842
Here's the basic idea:
<cfset domain = cgi.server_name>
<cfset subDomain = "">
<cfif ListFirst(domain, ".") neq "foo" and ListFirst(domain, ".") neq "www">
<cfset subDomain = ListFirst(domain, ".")>
</cfif>
Upvotes: 7