3

Having looked at the descriptions provided for the following modules

  • ip2cc
  • ip2country
  • geoip
  • smart_ip

I'm having trouble identifying which module would be the simple solution to my scenario.

I have established 'Landing Pages' which represent the different countries for my website. (initially)

e.g: - www.example.com/au (Australia) - www.example.com/us (United States) - www.example.com/uk (United Kingdom)

If a user lands at the www.example.com url and they are from IP addresses in Australia, United States or the UK, I'd want it to direct them to the appropriate landing page.

I'm not sure which module is the most appropriate for this scenario and how it would be applied.

Many thanks for your help.

1 Answer 1

2

All of the modules you have listed only provide APIs, choose one for which you need least maintanence. For geoIp you need to keep updating County List DAT file manually once in 3~4 months, I am not sure about others. Once you choose your module you have to write logic for your scenario, something like this

$cc = geoip_country_code();
if($cc == "AU"){
  drupal_goto(MY_AUSTRALIAN_SITE_URL);
}

You can use page--front.tpl.php or make use of drupal_is_front_page() in page.tpl.php to write your own logic.

2
  • 1
    While this is correct, might I suggest that it would be much simpler to put the code in template.php and limit it to a simple drupal_goto('/' . $cc); There should be no need to do if/switches on every country code since Marcus already has the url structure set up. Commented Oct 28, 2012 at 10:50
  • @nowarninglabel I am not sure if they are correct/final URLs he s gonna use so the IF/ELSE ladder I just gave a hint on how to use APIs.
    – GoodSp33d
    Commented Oct 28, 2012 at 12:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.