Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alias confused with culture_key #48

Closed
jmbuytaert opened this issue Dec 20, 2011 · 5 comments
Closed

alias confused with culture_key #48

jmbuytaert opened this issue Dec 20, 2011 · 5 comments

Comments

@jmbuytaert
Copy link

I have a site in 3 contexts: web, french (culture key: fr) and german (culture key: de). In the web (english) context, I have some alias that begin with "de" (ex: demand.html).

The problem is the following: Babel only takes the first 2 letters after the sitename and transfers it to its culture key, so when I load www.site.com/demand.html, it considers it as www.site.com/de/mand.html, therefore directing me to a 404 page.

This should not be happening. Babel is a great tool and I'm glad that I found it, I just hope that this gets fixed quickly!

Thanks.
jm

@mikrobi
Copy link
Owner

mikrobi commented Dec 20, 2011

Please note that Babel itself doesn't perform any redirects. Currently there is no gateway plugin shipped with Babel. How does your gateway plugin look like? Are you using any htaccess redirects?

@jmbuytaert
Copy link
Author

if (stripos($_SERVER['REQUEST_URI'],'/fr') !== false || stripos($_SERVER['REQUEST_URI'],'/fr/') !== false) {
    $modx->switchContext('french');
    $modx->setOption('cultureKey', 'fr');

} elseif (stripos($_SERVER['REQUEST_URI'],'/de') !== false || stripos($_SERVER['REQUEST_URI'],'/de/') !== false) {
    $modx->switchContext('german');
    $modx->setOption('cultureKey', 'de');

} else {
    $modx->switchContext('web');
    $modx->setOption('cultureKey', 'en');
}

@mikrobi
Copy link
Owner

mikrobi commented Dec 21, 2011

Here we go, the unwanted behaviour is caused by your own gateway plugin. This statement validates to true for something like /demand.html

 stripos($_SERVER['REQUEST_URI'],'/de') !== false

Check out the offical Babel tutorials at http://www.multilingual-modx.com/ to get your context switches work properly.

@mikrobi mikrobi closed this as completed Dec 21, 2011
@jmbuytaert
Copy link
Author

That was what was wrong! Thank you! But I want people to be redirected to
the german context wether they type in site.com/de/ or site.com/de (with or
without the trailing slash... is that something that I need to add in the
htacess file?

On Wed, Dec 21, 2011 at 2:38 AM, Jakob Class <
reply@reply.github.com

wrote:

Here we go, the unwanted behaviour is caused by your own gateway plugin.
This statement validates to true for something like /demand.html
stripos($_SERVER['REQUEST_URI'],'/de') !== false

Check out the offical Babel tutorials at http://www.multilingual-modx.com/to get your context switches work properly.


Reply to this email directly or view it on GitHub:
#48 (comment)

Best Regards,

Jean-Marc Buytaert
jmbuytaert@gmail.com
http://www.webdziner.com
832.886.8187

@mikrobi
Copy link
Owner

mikrobi commented Dec 21, 2011

Yes, I think so. Take a look at this tutorial for some htaccess rules: http://www.multilingual-modx.com/blog/2011/seo-friendly-multilingual-websites-with-modx-and-babel.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants