ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Multiple languages with subfolders and redirect problem

February 24, 2011 6:54am

Subscribe [2]
  • #1 / Feb 24, 2011 6:54am

    arbuk

    1 posts

    Hello community,

    I have a rather annoying problem i could use some help with.

    I added 2 languages to my Expression Engine installation, following a guide by madebyhippo (http://www.madebyhippo.com/herdspeak/view/multilingual_websites_in_expressionengine).  It aims on creating subfolders for every language containing the index.php file and then searches for a language variable within the channel tag ( {exp:channel:entries channel='ihcw' category="17" search:static_lang="{countrycode}”). It then alters the site url to *.com/en/index.php for English or *.com/de/index.php for German (standard language).

    My problem now is that when surfing to the homepage one would not enter anything but *.com in the browser. So no language is chosen at first. The problem is that several channel tags are generated empty because no language is chosen.

    I changed the root-url in EE to be *.com/de/ without any effect on the homepage (rest works fine). So I tried to add a redirect on the unix server’s htaccess file ( redirect 301 / *.com/de/ ) but it generates a loop… redirect 301 /web *.com/de/web does not work neither (I renamed the index.php into web).

    So my question is if someone knows a solution to that problem either on the htaccess side or on the ExpressionEngine side.

    Thanks for the input in advance!

    Best,

    Janek

  • #2 / Feb 24, 2011 4:41pm

    Ingmar

    29245 posts

    Welcome to the forums, Janek!

    My problem now is that when surfing to the homepage one would not enter anything but *.com in the browser. So no language is chosen at first. The problem is that several channel tags are generated empty because no language is chosen.

    I would suggest a forward / redirect on your site’s index page. This could be done with EE (check if segment_1 is either en or de, redirect to de if it’s not) or outside of it (using some mod_rewrite in .htaccess).

    My suggestion would be to try the first approach first. Perhaps something like this

    {if segment_1 != "en" && segment_1 != "de"}
      {redirect="de/index"}
    {/if}
  • #3 / Feb 27, 2011 6:37am

    arbuk

    1 posts

    Hey Ingmar,

    Thank you for your hint. The problem is that the language parameter in the link is not a segment because it is before the index.php (links are http://www.website.com/en/index.php/template/.

    I solved this problem with an ugly workaround. The menu links and channels within the frontpage index.php have a fixed language now and all other links to the frontpage direct to a different - and stil dynamic - file.

    Best,

    Janek

  • #4 / Feb 28, 2011 3:25am

    John Henry Donovan

    12339 posts

    Janek ,

    Glad you found a workaround. Feel free to start a new thread if you have any more questions.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases