Hi there,
I'm currently scoping a multi-lingual solution for a client and am looking at GeoIP to handle mapping of IP-detected countries to languages. However every time I go to admin/settings/language/configure and choose "Path prefix with GeoIP detection fallback", when I hit save I get a redirect loop on every page of the site. I've tried this on a Pressflow install and also on a completely clean new D6 install and this invariably happens when I make that configuration change. I'm sure someone must have come across this before but I see nothing in the issue queue - any idea what could be causing this?

thanks,
Katherine

Comments

meba’s picture

Project: GeoIP API » Global Redirect
Version: 6.x-1.1 » 6.x-1.2
Component: GeoIP Language » Code
Status: Active » Needs work
StatusFileSize
new678 bytes

I bet you also have globalredirect module?

I fixed this by adding this code:

    if (module_exists('geoip_language') && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) == GEOIP_LANGUAGE_NEGOTIATION_PATH) {
      $options['prefix'] = $options['language']->prefix;
    }

around line 100 in globalredirect.module. Attaching a patch and reassigning issue to globalredirect module. I certainly dislike this patch so I am posting it as a proof of concept only. Not sure how to solve this properly, this is rather module specific condition.

(The problem is that language_url_rewrite doesn't know GEOIP_LANGUAGE_NEGOTIATION_PATH therefore doesn't set "prefix". That's when the redirect happens.

katbailey’s picture

Project: Global Redirect » GeoIP API
Version: 6.x-1.2 » 6.x-1.1
Component: Code » GeoIP Language

No, like I said I tried this with a fresh D6 install with no other contributed modules. I'd noticed that most similar problems encountered by people involved the Global Redirect module but not so in my case.

drewish’s picture

Okay confirmed this on a site here. I think Roger had fixed this but it didn't get committed back to contrib. I'll need to do some archeology in our SVN repo.

perandre’s picture

Version: 6.x-1.1 » 6.x-1.2

Same thing here. All pages end up in a loop, and I have to manually disable the geoip_language module in the db.

petiar’s picture

Priority: Normal » Critical

Same thing here. Just for curiosity - how could you deploy a new version without noticing this kind of issue?

drewish’s picture

well, all i can say is we're using it on 300+ sites and haven't run into it. please give me clear instructions on how to replicate it on a clean site install.

vectoroc’s picture

Status: Needs work » Needs review
StatusFileSize
new710 bytes
new698 bytes

I've written 2 patches that could help. I'm not sure which way is better

vectoroc’s picture

Change (url($_GET['q'], array('language' => $language)) == $_GET['q']) to (url($_GET['q'], array('language' => $language)) == base_path().$_GET['q']) in second patch

perandre’s picture

Thanks, Vectoroc! I applied the first patch, and it does the job.

alexbk66-’s picture

Thanks @vectoroc, #7 works!

bojanz’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)