I would like to redirect users based on the state they are in to another website address as well as exclude an IP address so they can access my site.
I have js API code from MaxMind, but I’m not sure how to do the rest:
Redirect users from PA, DE and NJ to Google.com but exclude IP address 174.343.198.99 so they can access the website even if they are in one of those states.
Redirect users from FL to Google.com, but exclude IP address 18.104.22.168 so they can access even if they are in FL.
Thank you SO MUCH!
Is there any reason why this couldn’t be done in php, or another server side script? It would be a lot easier and faster. In PHP, the IP address is available as $_SERVER[‘REMOTE_ADDR’], and it is very easy to get a location from an IP address using:
$ip = @FiLe_get_contents(“http://automation.whatismyip.com/n09230945.asp”);
All you have to do is parse what is returned and you have your state.
Hi - I already have a PHP script but it doesn’t work good enough. The api for maxmind connects to their full database which is a lot more accurate than free services.
Does maxmind have a PHP version of their API?
Sent from my Desire HD using Tapatalk
They have this: http://www.maxmind.com/app/php
But it requires you to download their free lite databases to use which is not what I want to do. I already use their “lite” free databases and they do not work right. I get about 1,000 people a month from the state I don’t want that don’t get redirected.