Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Global Redirect goes into an infinite loop when locale module has been configured to use Path Prefixes.
Proposed Solution
The original issue (patch provided in #9) as well as some followup issues from #10 and #12 have all now been fixed in 7.x-1.x-dev branch.
Remaining tasks
None. This is already committed and fixed! I wrote this summary because I missed comment #25 explaining that this had been committed and fixed because people hijacked the thread and kept subscribing. :)
This bug reoccurs in the 7.x-1.4 release.
Original report by lnunesbr
This module crashed my drupal 7 installation with internationalization. It goes to a infinity recursive redirect.
Comment | File | Size | Author |
---|---|---|---|
#83 | infinite_loop_error-1034126-83.patch | 870 bytes | efpapado |
#48 | fix_infinite_loop.patch | 1.83 KB | berdyshev |
#41 | globaldirect-n1034126-41.patch | 676 bytes | DamienMcKenna |
#34 | languageAliasLoop-1034126.patch | 674 bytes | ASupinski |
#12 | globalredirect.patch | 850 bytes | albertosilva |
Comments
Comment #1
Bright Web Design CreditAttribution: Bright Web Design commentedSame for me too. I use i18n with multiple languages and it produces this error or message site is not accessible. Site is accessible only through the default language.
Please see the attached screen shot.
Comment #2
SebCorbin CreditAttribution: SebCorbin commentedChanging title & subscribing
Comment #3
danmccarey CreditAttribution: danmccarey commentedsubscribing
Comment #4
rayfun CreditAttribution: rayfun commentedsame here.. subscribing
Comment #5
amalaer CreditAttribution: amalaer commentedsame here.. subscribing
Comment #6
luckystrikerin CreditAttribution: luckystrikerin commentedsubscribing
Comment #7
mjgruta CreditAttribution: mjgruta commentedThis also happens to me.
When Global Redirect enabled:
website.com/en/page <- problem
website.com/page <- OK
Comment #8
nico059 CreditAttribution: nico059 commentedSame problem here ... the correction:
globalredirect.module: line 82 and 87
I think, in D7 ... language_url_rewrite should be replaced by locale_language_url_rewrite_url
In my case this resolve the infinite loop ... no extensive test done yet ...
Thx nicholas for your module and your time contributed to Drupal ;-)
... excuse my quick post ... I'm in a rush ...
Comment #9
SebCorbin CreditAttribution: SebCorbin commentednico059 was right, here's a patch
Comment #10
mjgruta CreditAttribution: mjgruta commentedThanks this works! and I think Global redirect fixes my problems on Views for not showing default language if no translation available.
also remember if you are using Views don't forget to add Filter: Node translation: Language -> Current user's language because Views->Query Settings->Field Language-> Current user's language is not working(I think so).
Some Problems:
and when I enable Language Path Checking I get this problem on a Page with a Views Block.
Comment #11
luckystrikerin CreditAttribution: luckystrikerin commentedI have the same prob with the Language Path Checking. Additionally after applying the patch I can't uncheck URL detection any more. This would let to strange redirects like sitename/.../en/en/.../.../en/xyz.
Comment #12
albertosilvaThe problem with LANGUAGE_NEGOTIATION_* is that all those variables come from Drupal 6, and are not present in Drupal 7.
I have a patch for "globalredirect.module", it works perfect so it maybe could help you.
Comment #13
tsvenson CreditAttribution: tsvenson commentedBrilliant, the patch got rid of the errors for me.
Comment #14
Marty2081 CreditAttribution: Marty2081 commentedPatch works for me. Thanks!
Comment #15
metalinspired CreditAttribution: metalinspired commentedWorked for me too. Thank you
Comment #16
mjgruta CreditAttribution: mjgruta commentedThe patch worked but global redirect is not really working with i18n as of now.
Comment #17
Dave ReidPlease post a patch using diff -u
Comment #18
Dave ReidPlease also post your patch against 7.x-1.x branch, not the 7.x-1.3 release as some of the patch has already been applied.
Comment #19
Cray Flatline CreditAttribution: Cray Flatline commentedsubscribimg
Comment #20
dmsmidtsub
Comment #21
mikl CreditAttribution: mikl commentedMaybe the solution for #346911: Redirect Loop and custom_url_rewrite ignored could be of help here?
Comment #22
lathansub
Comment #23
FiNeX CreditAttribution: FiNeX commentedPatch on #12 works fine :-) Thanks!
Comment #24
Daemon_Byte CreditAttribution: Daemon_Byte commentedsubscribe
Comment #25
nicholasThompsonI have committed the fixes from #12 into 7.x-1.x-dev. I have also added several SimpleTest rule to ensure redirection is acting sensibly.
Comment #26
cronix CreditAttribution: cronix commentedAny idea when this will result in a new "stable" release?
Comment #27
tovetsky CreditAttribution: tovetsky commentedHi all,
I can confirm that the problem still exists under the following scenario:
Internationalization 7.x-1.0-beta5
Global Redirect 7.x-1.3
Fix #8 above from nico 059 got me out of the infinite loop. 2 lines need to be edited. The one that checks if the function exists and the one that executes the function. Both lines in 'globalredirect.module' need to be changed to 'locale_language_url_rewrite_url'. Here's the block of code.
Thank you nico059
Comment #29
floown CreditAttribution: floown commented@tovetsky : I have apply your patch, it does not work now with : Global Redirect 7.x-1.x-dev (2011-May-03) and I18n 7.x-1.0-beta7…
Comment #30
tahiticlic CreditAttribution: tahiticlic commentedsubscribe
Comment #31
giupenni CreditAttribution: giupenni commentedsubscribe
Comment #32
camdarley CreditAttribution: camdarley commentedsubscribe, same config than floown and patch from tovetsky not working
Comment #33
daften CreditAttribution: daften commentedsubscribe
Comment #34
ASupinski CreditAttribution: ASupinski commentedI ran into this issue, or something remarkably similar and found that my problem was that drupal_get_path_alias will return the original path if there is no alias. If this path already contains the language prefix then the existing global_redirect check
if ($request_path != $prefix . $alias)
will always be true causing the loop. I believe the attached simple patch resolves this issue.Comment #35
irishdan CreditAttribution: irishdan commentedsubscribe
Comment #36
DamienMcKennaShould I write "+1" or "Subscribe"? Hrm... Oh, wait.
Comment #37
DamienMcKennaMarking this ticket as Fixed again as the new issue is unrelated to the original topic. Please open a new issue referencing this one if needed.
Comment #39
erasoft CreditAttribution: erasoft commentedHi, I got the same error... What should I do with this patch?
Comment #40
DamienMcKennaThe patch from #34 needs work, it doesn't follow the Drupal coding standards.
Comment #41
DamienMcKennaI've cleaned up the patch from #34.
FYI please check the documentation on how to apply patches.
Comment #42
j.somers CreditAttribution: j.somers commentedsubscribe
I also want to note that the patch attached to #1034126-41: Infinite loop (error 310) with i18n in D7 did not work for me. However, the patch attached to #774950-7: Incompatible with hook_url_inbound_alter() did solve this in my case.
Comment #43
SebCorbin CreditAttribution: SebCorbin commentedComment #44
icetristar CreditAttribution: icetristar commentedComment #45
robphillips CreditAttribution: robphillips commentedNone of the patches above seemed to work for me. Using the latest stable versions of globalredirect and i18n I modified globalredirect.module to recognize when i18n is present. I tested this thoroughly and it enabled full translation support. Feel free to modify and/or put into a patch file.
globalredirect.module, lines 217 to 231
Comment #46
patrick mbongo CreditAttribution: patrick mbongo commentedHi ! i try to use global redirect (the latest dev version ) but it not working with multilingual multisite drupal installation....in the other subdomain site it generate url like this
"http://mysite.com/it/it/it/it/it/it/it/it/it/it/it/it/it/it/"(italian is default language but it the same with the other languages ) .solution?
thanks
Comment #47
matthiasm11 CreditAttribution: matthiasm11 at MM-Experience commentedThe code of post #1034126-45: Infinite loop (error 310) with i18n in D7 works almost fine.
(applied to the globalredirect.module, stable version 1.3)
This goes fine:
mysite.com/title-of-my-node (should redirect to mysite.com/nl/title-of-my-node, because nl is my default language?)
mysite.com/nl/node/25 turns into mysite.com/nl/titel (nl = dutch language, "titel" is dutch for title)
mysite.com/fr/node/8 turns into mysite.com/fr/titre (fr = french, "titre" is french for title)
mysite.com/admin
This goes wrong:
mysite.com/node/25 -> 301 loop
mysite.com/nl -> 301 loop
mysite.com/fr -> 301 loop
mysite.com/nl/admin -> 301 loop
mysite.com/fr/admin -> 301 loop
mysite.com/nl/node/8 turns into mysite.com/nl/titre (= french node showed with a dutch prefix but french title in the url -> should redirected to mysite.com/fr/titre)
mysite.com/fr/node/25 turns into mysite.com/fr/titel (= dutch node showed with a french prefix but dutch title in the url -> should be redirected to mysite.com/nl/titel)
Some changes in the code of post #1034126-45: Infinite loop (error 310) with i18n in D7 could possibly fix this?
Kind regards,
Matthias
Comment #48
berdyshev CreditAttribution: berdyshev commentedyes, changes from comment #45 work, but the same changes must to be introduced for front page
here is patch, that works for me. please review it.
Comment #49
matthiasm11 CreditAttribution: matthiasm11 at MM-Experience commentedThnx BerdArt!
Your patch solved the 301 loops.
These redirections shoud be updated:
mysite.com/nl/node/8 -> no redirect (= French node showed with a Dutch prefix and node_id in the url -> should redirected to mysite.com/fr/titre)
mysite.com/fr/node/25 -> no redirect (= Dutch node showed with a French prefix and node_id in the url -> should be redirected to mysite.com/nl/titel)
mysite.com/title-of-my-node should be redirected to mysite.com/nl/title-of-my-node, because nl is my default language, so there aren't 2 urls for the same content. (search engine optimalizaton - sandboxed)
Any fixes?
Kind regards,
Matthias
Comment #50
piepkrak CreditAttribution: piepkrak commentedsubscribe
Comment #51
mattez CreditAttribution: mattez commentedLast DEV version globalredirect 7.x-1.x-dev (updated: May 3, 2011 - 00:11) FIX this issue for me.
Comment #52
iAugur CreditAttribution: iAugur commentedLast DEV version globalredirect 7.x-1.x-dev (updated: May 3, 2011 - 00:11) Fixed this issue for me too (D7-commerce-multilingual site)
Comment #53
bartvdputte CreditAttribution: bartvdputte commentedLast DEV version globalredirect 7.x-1.x-dev (updated: May 3, 2011 - 00:11) FIX this issue for me.
Use the DEV version, it'll fix this issue.
Comment #55
rickmanelius CreditAttribution: rickmanelius commentedPatch not necessary as it's committed to dev and it works for me, #51, #52, and #53. Marking as fixed.
Comment #56
Summit CreditAttribution: Summit commentedHi,
Dev of 3 december 2011 is not good enough, patch 48 was still necessary for me,
So I had to add patches:
http://drupal.org/node/1034126#comment-4078848, http://drupal.org/node/1034126#comment-4848778 and http://drupal.org/node/1034126#comment-5102720
I think now it is working with i18n.
Greetings, Martijn
Comment #57
khiminrm CreditAttribution: khiminrm commentedThe same error in Dev version from 24 november, 2011
Comment #58
Meller CreditAttribution: Meller commentedhad the same problem, version globalredirect-7.x-1.x-dev solved it for me.
Comment #59
torbjoernk CreditAttribution: torbjoernk commentedDev tarball from 2011-Nov-24 fixed this issue for me in combination with D7.10 and i18n 7.x-1.2. Thank you for fixing :)
Comment #60
typoagrafka CreditAttribution: typoagrafka commentedsubscribing
Comment #61
checker CreditAttribution: checker commentedIn my case i got it fixed with unsetting a prefix for default language. Only for non-default languages you need a prefix. (global redirect dev 2011-Nov-24)
Comment #62
nicholasThompsonFYI, Patch #12 made it into the 1.4 release.
This needs some more work as I'm not very familiar with i18n...
Comment #63
javizcaino CreditAttribution: javizcaino commentedI have updated today to version number 1.4 and the problem is still there...
I'm affraid I'll have to remove this module from my installation...
Comment #64
FlowerOS CreditAttribution: FlowerOS commentedProblem reappeared after upgrade to 7.x-1.4
Comment #65
checker CreditAttribution: checker commented@javizcaino @FlowerOS please can you tell us your language and negotiation settings?
Comment #66
axe312 CreditAttribution: axe312 commentedI have the exact same problem. My default language is "de", "en" is also active and i have the default settings of all modules (fresh installation). I also have i10n_update installed. Maybe this causes the problem.
Comment #67
checker CreditAttribution: checker commented@axe312
did you try to remove path prefix "de" under "admin/config/regional/language/edit/de"? I guess you don't need it because its your default language.
Comment #68
Satri CreditAttribution: Satri commentedSimilar problem after updating from 1.3 to 1.4. I got a redirect loop in the form of:
interactiveweather.ca/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr/fr
Note that the only language-related modules I use on that site are: I10n_update and transliteration.
Hope this helps. - Alex
Comment #69
trante CreditAttribution: trante commentedsubscribe
Comment #70
FlowerOS CreditAttribution: FlowerOS commentedSite is "ro" and this is the default language on site.
Comment #71
sa3er CreditAttribution: sa3er commentedThe same problem here as in #68
http://mysite.com/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/fa/...
English is also active but the default language is Persian.
had to downgrade to 7.x-1.3
Comment #72
javizcaino CreditAttribution: javizcaino commented@checker, my language negotiation is "Default - Use default site language (Spanish)"
Comment #73
hgmartini CreditAttribution: hgmartini commentedAs in #68, I just had the same issue after updating to 7.x-1.4. It was working fine with 7.x-1.3. In my case, all pages get redirected to /en/en/en/...
The only language detection methods enabled are "User" and "Default" (default is Spanish) and enabled languages are es and en. I'm using l10n_client 7.x-1.0, l10n_updates 7.x-1.0-beta2, i18n* 7.x-1.2.
I guess it redirects to /en because my environment and browser settings are English, although "Browser" language detection is disabled in Drupal.
For now I'll have to go back to 1.3.
Please tell me if there's something else I can do to help solve this.
Comment #74
ronny89 CreditAttribution: ronny89 commentedsee #1034126: Infinite loop (error 310) with i18n in D7
Comment #75
scitoMy infinite redirections are gone with the lastest dev version. i18n and globalredirect are working for me. I'm just using the latest globalredirect dev version, no additional patches.
Thanks for your job!
Comment #75.0
scitoCreated a summary to let people know this is already fixed!
Comment #76
TipiT CreditAttribution: TipiT commentedConfirmed. Latest dev (7.x-1.x-dev) fixed the problem. Thank you!
Comment #77
AdamGerthel CreditAttribution: AdamGerthel commentedConfirmed here too. Seems to work well
Comment #78
cateye CreditAttribution: cateye commentedIs there a chance for a new release with this fix?
Comment #79
pfrenssenThis is actually an old issue which has been fixed a long time ago (see comment #25).
The redirection loop is occurring again in the latest release, but this may have a different cause since the original problem had been fixed. The problem is now being tracked in #1378690: Update to 7.x-1.4 adds duplicate language prefixes, causing a redirection loop. I'm going to mark this as a duplicate since the other issue has more current test reports.
Please mind that the problem has *not* been fully fixed in the latest dev. The problem is fixed only with certain language negotiation configurations but still occurs with other configurations. This probably will also need some tests before a new release can be made.
Comment #80
XO-1 CreditAttribution: XO-1 commentedAnother confirm, though site is still in testing, problem seems to be solved after the install of the 7.x-1.x-dev.
P.S. if it is any help to other newbies: i just went to the sites>all>modules>globalredirect folder. Deleted all the files in that folder, and replaced with the unzipped files from the 7.x-1.x-dev download.
Special thanks to nicholasThompson and everybody else for all your effort on fixing this problem.
Final request: can somebody make it more clear that 7.x-1.4 is not the best choice for downloading right now? It does not mention that very clearly on de globalredirect download page right now.
I am so #@$#$ relieved that my site is accessible again... hahaha :P
Comment #81
pfrenssen@XO, this is already mentioned on the project page, look under "Known bugs" ;)
Comment #81.0
pfrenssenUpdated remaining tasks
Comment #83
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedHi, there are several tasks concerning an infinite loop that is caused when Language Path Checking is enabled, and I think the issue queue needs a cleanup.
Current dev version seems to still have the same problem.
My setup: Two active languages, and the default does not have a prefix (blank value). Enabling Language Path Checking causes infinite redirect loop error.
I propose a patch. I have only tested it with my setup, and it seems to work, but I don't know if it's going to work on different setups.
Comment #84
efpapado CreditAttribution: efpapado at Ramsalt Lab commentedChanging status and version.
Comment #85
albertosilvaComment #86
Chris Matthews CreditAttribution: Chris Matthews commented@efpapado, if your comments in #83 are still relevant you'll probably need to open another issue.