Redirecting users

Hi guys!

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:

<script language="JavaScript" src=""></script>
<script language="JavaScript">document.write(geoip_region());</script>

An example:

Redirect users from PA, DE and NJ to but exclude IP address 174.343.198.99 so they can access the website even if they are in one of those states.

Another example:

Redirect users from FL to, but exclude IP address 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(“”);

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?

While javascript would certainly work, doing redirects on the server is always better (faster and more reliable)

Sent from my Desire HD using Tapatalk

They have this:

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.