Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirecting based on subdomain

Status
Not open for further replies.

dalar

Programmer
Sep 19, 2004
18
0
0
GB
Hi, is there a way in Javascript that we can read the URL that user entered?

This is so, that we can see if the url contains a subdomain other than www. and if it does, then I would like the option to redirect the user to another link.

the most common subdomain will be forum (forum.mydomain.com) - I guess the search we want to peform is for it to search from http:// and to then grab the word before a period (.)

Thanks for your help
 
Thank for that.

Can anyone help me build an expression that can extract the word between http:// and (.) so that I can have the actual subdomain word in a variable, then I can test it with an IF query

thank you
 
[tt]window.location.href.split(/\./)[0].split(/http:\/\//)[0][/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top