OK, I’ve just added the snippet on another page and it does the return the correct URL:
http://example.com/fr/test/child.html
So, I have to find what’s wrong with my setup...
Intégrateur web freelance
Just for the information, if I remove the site_url setting from the context, the redirection is working.
But of course, without this setting, I no longer have the fr alias in the URL... So this is not what I’m after.
Intégrateur web freelance
Hi Firytree,
How did You managed to display images and load css, js files with this plugin soulution?
In my case this solution brakes the webpage since base href is mydomain.com/EN/ and all links relate to this base url.
luke
-
☆ A M B ☆
- 33 Posts
The solution in this thread has been a brilliant and elegant solution for a multi-language site I’m working on. But I did have the same problem when trying to display a container page. In my testing, the problem resulted because the trailing slash was getting stripped off by the plugin when it needed to be there for container pages.
My solution was simple, and it seems to work without any side effects to the solution given. Remove the second argument from "trim" - so change the line:
$pieces = explode(’/’, trim($_REQUEST[$modx->getOption(’request_param_alias’, null, ’q’)], ’/’), 2);
To:
$pieces = explode(’/’, trim($_REQUEST[$modx->getOption(’request_param_alias’, null, ’q’)]), 2);
Hello
FistChildRedirect did not work for me in a other context than the default 'web' when using context for different domains.
I had to change line 77 in the Snippet:
return $modx->sendRedirect($url);
to
return $modx->sendRedirect($modx->config['site_url'].$url);
then it worked.
Note:
(I did set site_url in the context settings)
Perhaps this helps someone.
Kind regards, Hanna