Hello all!
I am in need of help with a geo-redirect.
I would like to have my site set up so when a user is linked to any page on my site, the redirect will send them to another appropriate page based on geo-ip.
Here is the code I am using:
My question is, how can I use this code so every page of my wordpress site uses the redirect???
Any help is greatly appreciated! Thanks!
edit:
I would like to add that to every page so that window.location = the current page.
or if GEO-IP = Else, redirect to http://site.com
So, I have a site with many pages of content. I would like to use this script on every page. If country = those listed, I would like the user to stay on that page. If country=Other I would like the redirect script to force the user to a different site.
I am in need of help with a geo-redirect.
I would like to have my site set up so when a user is linked to any page on my site, the redirect will send them to another appropriate page based on geo-ip.
Here is the code I am using:
Code:
<html><script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script> <script language="JavaScript">
var country= geoip_country_code();
if(country == "CA" || country == "UK" || country == "AU" || country == "DE" || country == "NO" || country == "FI" || country == "NZ" || country == "ZA" || country == "DE" || country == "IT" || country == "FR" || country == "IE" || country == "PT" || country == "BE" || country == "NL")
{
<!--
window.location = "http://www.site.com"
//-->
}
else{window.location = "http://site.com"}
</script></html>
My question is, how can I use this code so every page of my wordpress site uses the redirect???
Any help is greatly appreciated! Thanks!
edit:
I would like to add that to every page so that window.location = the current page.
or if GEO-IP = Else, redirect to http://site.com
So, I have a site with many pages of content. I would like to use this script on every page. If country = those listed, I would like the user to stay on that page. If country=Other I would like the redirect script to force the user to a different site.
Last edited: