Hi,
If you're using the classic ASP scripting language you can add the following code to the header of each page, or use an include:
PHP Code:
<%
Function TLsplit(StrToSplit,Delim)
Dim StrArray()
If StrToSplit = "" Then
ReDim StrArray(1)
StrArray(0) = 0
StrArray(1) = ""
TLsplit = StrArray
Else
dcount = 0
For TLsI = 1 To Len(StrToSplit)
If Mid(StrToSplit,TLsI,1) = Delim Then dCount = dCount + 1
Next
If dCount = 0 Then
ReDim StrArray(1)
StrArray(0) = 1
StrArray(1) = StrToSplit
TLsplit = StrArray
Else
ReDim StrArray(dCount + 1)
StrArray(0) = dCount + 1
TempArray = Split(StrToSplit,Delim)
For TLsI = 1 To dCount + 1
StrArray(TLsI) = Trim(TempArray(TLsI - 1))
TLsplit = StrArray
Next
End If
End If
End Function
Dim MainDomain
MainDomain = "yourdomain.com" your domain without the www
SplitHeader = TLSplit(Request.ServerVariables("SERVER_NAME"),",")
If Request.ServerVariables("SERVER_NAME") = Request.ServerVariables("LOCAL_ADDR") Then
Response.Redirect("http://" & MainDomain)
ElseIf SplitHeader(1) = "www" Them
Response.Redirect("htp://" & MainDomain)
End If
%>
Something like that should do. TLSplit function courtesy of powerasp.com.
__________________
Regards,
Josh Hold
eUKhost Blog: Over 1000 Computer Related Articles to Sink Your Teeth Into!
LDN GIGS - Gig Listings for London
Super Moderator
I'm only a forum gremlin (moderator), and do not work for eUKhost in any way. Opinions expressed by me are mine only, and do not reflect those of either eUKhost or any company that may be listed above.
I don't bite, honest.