|
|
Question : How to redirect based on IP address
|
|
How do I redirect visitors to a web site by their source IP address. I want to be able to send users local to the network to one web page, and anyone outside of the company to a different web page.
I want to send the local IP address range of 10.0.0.1 through 10.0.254.254 to index1.asp and I wan to sent all others to index2.asp.
I've found some sample asp code from google, but I haven't had any success yet.
Thanks.
|
Answer : How to redirect based on IP address
|
|
This works for me:
remoteIP = request.servervariables("REMOTE_ADDR") if left(remoteIP,5)="10.0." then page="index1.asp" else page="index2.asp" Response.Status = "301 Moved Permanently" Response.AddHeader "Location", page
|
|
|
|