1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Geo-Redirect Help Needed - Wordpress

Discussion in 'Black Hat SEO' started by blackh4ts, Apr 9, 2012.

  1. blackh4ts

    blackh4ts Registered Member

    Joined:
    Jun 25, 2010
    Messages:
    70
    Likes Received:
    12
    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:

    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: Apr 9, 2012
  2. blackh4ts

    blackh4ts Registered Member

    Joined:
    Jun 25, 2010
    Messages:
    70
    Likes Received:
    12
    bumpp
     
  3. hellohellosharp

    hellohellosharp Power Member

    Joined:
    Dec 8, 2010
    Messages:
    625
    Likes Received:
    552
    Occupation:
    CEO @ CLEANFILES LLC
    Location:
    USA
    Home Page:
    Open up the editor for your theme (in the Appearance section) and find header.php

    You can throw the JS in there.

    Also, you can use my site (free for BHW) for premium geo-redirects and analytics:
     
    • Thanks Thanks x 1