Sagewire Logo

Help find if subdomain exists, then redirect

3 Message(s) by 3 Author(s) originally posted in cfml discussion


From: jeffromace Date:   Wednesday, October 24, 2007
<CFIF len(ListFirst(CGI.SERVER_NAME, "."))>
<CFSET UserName = ListFirst(CGI.SERVER_NAME, ".") />
<CFLOCATION
url="http://mysite.com/index.cfm?method=profile&member=#UserName#"
addtoken="no">

<CFABORT />
</CFIF>

What I want it to do is see if a subdomain exists which'd be the username
of a visitor. So for example if a domain is entered like this.

http://superman.mysite.com

It'd then become:
http://mysite.com/index.cfm?method=profile&member=superman

Usernames'd be no more than 12 characters.

I have added a wildcard to my [def]DNS [/def] (Domain Name Service) and it still does not seem to be working.. Is
there a better way of doing this?


From: jdeline Date:   Wednesday, October 24, 2007
Do a <CFDUMP VAR=#UserName#> before the CFLOCATION. Is it what you expect? What happens when you type http://mysite.com/index.cfm?method=profile&member=superman into your browser?


From: dacf Date:   Friday, October 26, 2007
Ummm, what is your problem here:
1. That your DNS doesn't resolve 'superman.mysite.com'?
2. Or that the domain name does resolve and you can not get ColdFusion to parse the
CGI.SERVER_NAME?

If 1. please supply both your Domain Name Server Type and also your web
server type
if 2. then follow jdeline's example



Next Message: CFIMAGE Text/Image Placement



Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional