Needs review
Project:
Global Redirect
Version:
7.x-1.5
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Apr 2012 at 23:50 UTC
Updated:
21 Jun 2020 at 06:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Sergii commentedSince redirect goes to another domain let url function determines whether the redirect is external.
Comment #2
paulrooney commentedTested, and works as intended. Thanks!
Comment #3
Anders Kallin commentedHi,
I'm not sure if I've configured my site in some weird manner, but I don't get this to work with this patch.
The URL protocol is not a part of
$lang->domain.I'm running on two private IP addresses but that could hardly have any impact, right?
http://192.168.0.131/node/1 (English node on Swedish site) redirects to http://192.168.0.131/192.168.0.130/wedding-logos instead of http://192.168.0.130/wedding-logos.
Comment #4
michaelpetri commentedI had the same problem, patch dosn't work for me.
This works for me:
Comment #5
gioppy commentedHi,
I had the same problem and I think the problem is the missing protocoll in the drupal_goto() url.
This works for me:
Comment #6
yehudade commentedVersion: 7.x-1.5
I also have an issue with the LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN case, but the issue is that there is no redirect.
The node has no special path, just node/2.
if node/2 is on english, he.domain.tld/node/2 does not get redirected to en.domain.tld/node/2 since the paths are both the same.
I tried fixing it but I did not get the loop's behavior and only caused a redirect loop.
Comment #7
yehudade commentedI went back to fix this issue, so here is my solution:
Instead of the current loop it checks for the actual node's language, Then if the current domain and the node language's domain are different it redirects to the correct domain.
(the use of the alias is just a bonus, to reduce redirects, e.g. lang1.domain.tld/node/2 > lang2.domain.tld/node/2 > lang2.domain.tld/somepage)
Comment #9
apanag commentedThe following code worked for me:
Comment #10
k4v commentedHere's another solution.
Comment #11
k4v commentedoops
Comment #12
k4v commentedComment #13
k4v commentedcorrected whitespace
Comment #14
aleksijohansson commentedSeems to be working fine with the newest release 1.5.
Comment #15
Koen.Pasman commentedI would like to reopen this issue because I suspect that the patch is not complete yet.
I'm running this patch together with a patched version of the redirect module (patched with https://www.drupal.org/node/1796596#comment-9313853 ) and when I'm trying to access a non-existing page, this patch creates an infinite redirect loop because $node is NULL here.
I've added this to the if-statement in my attached patch to prevent these redirect loops.
Comment #19
Koen.Pasman commentedAlso, I am currently running into problems where I have nodes that are not translatable (and actually also not viewable on their own). Viewing the node causes to create an infinite loop. I adjusted my patch to check for the LANGUAGE_NONE case, in which I think we should not redirect at all.
Comment #20
Koen.Pasman commentedComment #24
jasom commentedWhy does the #19 patch failed testing? It worked for me.
Comment #25
beumont commentedApplied patch #19 and works for me too! Will test this this week and post any errors
Comment #26
Koen.Pasman commentedRerolling patch to see if new tests will succeed, minor change in using globalredirect_goto() instead of drupal_goto()
Comment #27
sumachaa commentedIs this same as https://www.drupal.org/project/globalredirect/issues/1653194
Comment #29
theruslanpatch #19 works for me, thanks a lot!
Comment #30
defra_touch commentedPatch #19 works for me too, thank you very much!
Comment #31
parisekCreated simple module that solve this issue for me https://github.com/parisek/custom_i18n_redirect (I prefer that instead of patching module)
Comment #32
miiimoooThis patch is based on the comment from @michaelpetri in #4
This fixes the problem when you have separate domains for languages - e.g. `mysite.se, mysite.com`
Going to http://mysite.se/node/123 where node/123 is in English will redirect to the correct alias on http://mysite.com/myalias
This works for me on a site with i18n, i18n_node, pathauto_i18n enabled (but not i18n_redirect)
Comment #33
mrinalini9 commentedRerolled patch for #32 as it failed to apply, please review.