Currently, redirect_get_current_redirect() is inconsistent with drupal_lookup_path():
- redirect_get_current_redirect() uses the language from $GLOBALS['language'].
- drupal_lookup_path() uses the language from $GLOBALS['language_url'].

This creates two problems:
- Redirects that were created for deleted aliases do not replicate the alias behavior 1:1.
- URLs that are redirected for anonymous users produce 404 for logged-in users, if their language is different.

I initially thought this to be a problem with url aliases, but I found that aliases actually work fine.
See #2907406: language-specific path aliases give 404 after login, if user language is different from default site language

Comments

donquixote created an issue. See original summary.

donquixote’s picture

Patch would be something like this, in redirect_get_current_redirect().

-    $redirect = redirect_load_by_source(current_path(), $GLOBALS['language']->language, drupal_get_query_parameters());
+    $redirect = redirect_load_by_source(current_path(), $GLOBALS['language_url']->language, drupal_get_query_parameters());

Maybe this would need to be configurable to not break existing sites.

pifagor’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

patch

donquixote’s picture

@pifagor Why is this patch named 'pathauto' instead of 'redirect'? :)

pifagor’s picture

StatusFileSize
new1.25 KB

Thanks, for the info. Fixed :)

neslee canil pinto’s picture

Status: Needs review » Reviewed & tested by the community

#5 worked fine. Moving to RTBC

pifagor’s picture

  • pifagor committed ef5849c on 7.x-1.x
    Issue #2908995 by pifagor, donquixote, Neslee Canil Pinto:...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

rohitbansal’s picture

global redirection is working for node/123 but not working for node/123/1