I have just updated global redirect from an older DEV to 6.x-1.0.

Immediately after update, all /admin URLs have stopped working. It's giving me infinite redirects.

Version my drupal is 6.4

CommentFileSizeAuthor
#2 globalredirect-6.x-1.0-295254-2.patch917 bytescdale

Comments

Freso’s picture

Status: Active » Postponed (maintainer needs more info)

Are you using the Locale or Content Translations modules? If so, it's most likely related to #216271: Endless loop with translation (D6) which contains discussion on it, as well as a few workarounds.

cdale’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new917 bytes

I had a similar problem, except it would not only be for /admin urls, but other urls on the site too. We actually created a custom language and set that to be the sites default language, but because our new language had a prefix, almost none of the paths worked. I think '/' worked, and so did '/admin', but only when we were logged out.

I tracked this down to an if check near the end of the globalredirect function call, that checked when the language prefix was not empty, if the 'prefix/alias' was equal to the requested path, which of course, it wasn't, because we were using the default language, which had no prefix, so alias was our path.

Basically, this check would then redirect to $alias, even if the current path we were on, was $alias. Hence, the redirect loop.

I'm not too familiar with this module, but I've attached a patch that I think should fix this issue without any side effects. it simply adds an extra check, so we don't redirect to the path we're already on.

nicholasthompson’s picture

Hmmm... I wonder if there is a better way of "wording" this...
Yours:

if ((empty($language->prefix) ? $alias : $language->prefix .'/'. $alias) != $_REQUEST['q'] && $alias != $_REQUEST['q']) {

If the language prefix is empty, then this effectively becomes:

if ($alias != $_REQUEST['q'] && $alias != $_REQUEST['q']) {
cdale’s picture

hmmm. I hadn't though of that. I only saw the part of the issue that causes the infinite redirect. What about something like the following. It says the same thing, just 'worded' differently.

if (((empty($language->prefix) || $alias == $_REQUEST['q']) ? $alias : $language->prefix .'/'. $alias) != $_REQUEST['q']) {
strangeways’s picture

How about this:

if ($alias != $_REQUEST['q'] && (empty($language->prefix) || $language->prefix .'/'. $alias != $_REQUEST['q'])) {

That should be logically equivalent (right?) and will let you remove the ternary operator from the condition.

cdale’s picture

I think this is actually a duplicate of issue Endless loop with translation (D6), but I'm not enough across it to be 100% sure, so I might leave it up to someone else who is to make that call. It does seem however that the latest patch in the above issue covers this one.

nicholasthompson’s picture

Status: Needs review » Closed (duplicate)

This does appear to be an issue with language prefixes - marking as duplicate of #216271: Endless loop with translation (D6).