GeoIP RewriteCond Country Redirection - exclude googlebot and other spiders

Discussion in 'Apache' started by clarky_27, Mar 5, 2011.

  1. #1
    Hello,

    I've set up GeoIP in my server and everything is running fine.
    Using a rule in my .htaccess file, i can redirect some foreign visitors directly to my english version website/forum.
    I just want to make sure googlebot and other important spiders are not redirected also, otherwise my native website/forum will not be crawled.

    Here is my .htaccess rule:

    # Redirect multiple countries to a single page
    RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(AD|AE|AF|AG|AI|AL|AM|AN|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BM|BN|BO|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|)$
    RewriteCond %{REMOTE_ADDR} !^66\.249\.(6[4-9]|[78][0-9]|9[0-5])\.
    RewriteRule ^(.*)$ http://www.website-in-english.net$1 [L]
    Code (markup):

    Is it ok, assuming googlebot IP RANGE is 66.249.64.0 - 66.249.95.255?
    Should i add anything more? Maybe some rule based on USER AGENT (googlebot, msnbot, etc) ?


    Thank you ! :)
     
    clarky_27, Mar 5, 2011 IP
  2. eleetgeek

    eleetgeek Peon

    Messages:
    129
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If I were you, I would do a header(location) depending on the geoIP to the relevant /language/ page and store that as a cookie, also, I would link all languages locations on my footer, this way Google will crawl ALL the sites not just 1.
     
    eleetgeek, Mar 5, 2011 IP