I ran into a problem one year ago, but our we changed the specifications and so it was not neccessary anymore(another question here commented). One year later now, the issue is back, harder as before and i have to solve this problem and do not know how or if it is even possible.

I am faced with the problem of integration regions into my url/entries. I thought i can use categories or lightswitches to set active regions in backend per entry. In the entry template, i check the languages for this entry and the active regions and i build up some correct links/urls. Hard to understand, so here an example: Entry 1 is available in 2 languages (en/fr) in 1 region(fr). So i need this Urls:


I set up 2 sites/languages (en/fr). so entry 1 is now available as:


Now i am stuck, because i do not know how to make "en-fr" possible instead of "en". The region in the URL should be available in template(so i can decide what is happening here based on the current region). This could be realized by getting the current URL and splitting, or by rewriting and parse the region-part as a parameter (www.domain.tld/en/entry1/?region=fr | www.domain.tld/fr/entry1/?region=fr), or by craft itself maybe (routing-hook).

I do not find a solution inside the craft configuration or hooking.

htaccess-rewrite is nor working like i expect.

And craft itself has no opportunity to define a siteUrl twice. ('fr' => getenv('CRAFTENV_BASE_URL') . 'fr' is set up, but i would need 2 definitions for the language "fr", so both urls would be possible:

[ 'fr' => getenv('CRAFTENV_BASE_URL') . 'fr', 'fr' => getenv('CRAFTENV_BASE_URL') . 'en-fr' ]

Setting up more sites so we can use the site-handle as "en-fr" / "fr-fr" was already tested, it should work, but we have to edit so much sites in an entry and would have so much identical content, this should not be neccessary, it is not a good solution to handle the content.

Has anyone an idea or tip for me how to solve this issue ?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.