I have a multilingual site, but I think the issue is just Domain Access.
$request_path gets the current path (e.g. node/2)
It then calls drupal_alter('url_outbound',$request_path, $options, $request_path);
Domain Access's version of hook_url_outbound_alter, domain_url_outbound_alter itself returns $request_path as the alias of the path, (e.g. "foo-bar").
So later on, when globalredirect redirects if $request_path != $prefix . $alias then it doesn't work as $request_path is already the alias.
(It does works for the multilanguage pages where there is a language prefix like "fr", but sites without a language prefix, e.g. using default language, fail.
I'm not sure how to get around this. Giving globalredirect a lighter weight than Domain Access works for the very first page load after a cache clear, but after that it stops working (presumably a caching thing of module hooks?).
Comment | File | Size | Author |
---|---|---|---|
#10 | globalredirect-1411704-url_outbound_alter-conflict.patch | 446 bytes | rimen |
Comments
Comment #1
apemantus CreditAttribution: apemantus commentedComment #2
apemantus CreditAttribution: apemantus commentedOK; so I checked the code, and this works fine with 7.x-1.4, just not with the dev release, so I've gone back to that: so, umm, yeah. This is why I should check with non-dev versions first.
Comment #3
dgtlmoon CreditAttribution: dgtlmoon commentedNot sure if this is the same, but check out this issue too #1215134: FYI, Domain Access Source and Global Redirect conflict
Comment #4
rudiedirkx CreditAttribution: rudiedirkx commentedIt's not the same.
I'm having this issue too. I don't understand why globalredirect calls url_outbound for the request path. The request path should be literal IMO. That's why DA 'conflicts', because it alters outbound urls, which makes sense obviously.
@apemantus What do you mean "works fine"? No conflict with globalredirect 1.4? I'm using 1.5 and it's not working. node/22 isn't redirected to my-alias even though it uses core paths.
Comment #5
apemantus CreditAttribution: apemantus commentedIt sorta works fine with me now using Global Redirect 1.5.
The following works:
example.com/node/1 -> redirects fine to /page-alias
example.de/node/2 -> redirects fine to /german-page-alias
example.ch/node/2 -> redirects fine to /de/german-page-alias
The following doesn't work:
example.ch/node/1 -> redirects incorrectly, as it goes to /de/node/1 rather than /en/page-alias
(Although example.ch/en/node/1 redirects correctly)
I haven't looked into why example.ch/node/1 fails, but to be honest, I think that may be to do with reasons other than global redirect.
Comment #6
rudiedirkx CreditAttribution: rudiedirkx commentedMy site isn't multilingual, just multi-domain. With Domain Access and Domain Path on, all global redirects don't work... Very simple reason (after debugging) is the
url_outbound
alter inglobalredirect_init()
that's implemented by Domain Acess (using Domain Path). I still don't get why globalredirect calls the url_outbound alter on the incoming url...Comment #7
apemantus CreditAttribution: apemantus commented@rudiedirkx - ah OK, I think that is an issue to do with Domain Path specifically and Global Redirect - check out http://drupal.org/node/1706560 for a very quick suggested patch/hack to get it working, at least until someone suggests something better or there's a change in Global Redirect.
Comment #8
rimen CreditAttribution: rimen commentedI think, we can pass additional parameter in $options array to inform other modules that hook_url_outbound_alter is invoked by globalredirect.
e.g.
Then we can check that it is the first or the second invoke of url_outbound_alter (we can add custom module parameter to options in the first call and check it on the second) and return alias only in the second invocation
Comment #9
rimen CreditAttribution: rimen commentedin addition to #8
Support for Global Redirect in domain_path updated
http://drupal.org/node/1706560#comment-6968396
Comment #10
rimen CreditAttribution: rimen commented#8 Patch attached
Comment #11
maijs CreditAttribution: maijs commentedI vote this to be merged in. In tandem with a patch in #1706560: Support for Global Redirect (#14) it solves the problem with redirection loop. This patch should not introduce any regressions and it allows a lot of flexibility for other modules.
Comment #12
BBCAgree with maijs. Just tested this out (#10 patch here plus #14 from Support for Global Redirect) on a couple of sites and it is working quite well.
Comment #13
nizer CreditAttribution: nizer commentedI concur, the patch in #10 seems to offer a workable solution.
Comment #14
pwiniacki CreditAttribution: pwiniacki commentedGood to know - I'm gonna test it, cause I'm building a site with use of DA. Gonna let you know if something is bad.
Comment #15
anydigital CreditAttribution: anydigital as a volunteer and commentedCheckout this module as an alternative solution: https://www.drupal.org/project/domain_path_rewrite
Every internal path will be automagically redirected to the related domain path with it.
Comment #16
BarisW CreditAttribution: BarisW at LimoenGroen commentedThanks. Looks good!
Comment #18
BarisW CreditAttribution: BarisW at LimoenGroen commentedCommitted to dev.