1

Drupal 6 installation, 13 languages. Users are being redirected to the correct language based on browser language and we have a link that includes visitors's country code (i get this code VIA GeoIP API). Problem is - if Drupal cache is enabled, it caches the pages and users are being redirected to different languages, and also country codes are wrong. If I disable cache, everything works, but the site is much slower.

Is there a way to use cache AND have GeoIP work correctly?

2
  • This is probably best as a feature request in the module's issue queue, though it looks like the module is no longer being actively developed. The module likely needs to be rewritten to offer this kind of feature. May 23, 2013 at 12:58
  • GeoIp provides APIs like geoip_country_code($ip_addr) which returns Country code for that IP. You could use this API in hook_boot() (This hook is independent of cache and will always be invoked). Based on country code you could then redirect using header
    – GoodSp33d
    May 23, 2013 at 14:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.