000-CMS
avatar oe1tkt
oe1tkt
11 Dec 2013

There is already a posted message at forum http://forum.joomla.org/viewtopic.php?f=711&t=801634 about that behavior.
When that setting is on : "remove url language code" the redirect may not work when the following conditions are set:

When you are on the English site (language "en"), the above setting removes the url language code to www.example.com/example2
Failure:
When on the site www.example.com/de/example1 and you enter the URL into browser: www.example.com/example2 the link will be build to www.example.com/de/example2 which causes a 404-page.

Solution:
Please change the following line at
plugins/system/languagefilter/languagefilter.php : (line 250)
Code:
// redirect if sef does not exists and language is not the default one
if (!isset(self::$sefs[$sef]) && $lang_code != self::$default_lang)
{

              //LOYTEC patch TK++ 2013-12-11; if path =""; then switch to the next language
              // $sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]->sef : self::$default_sef;
              $sef = (isset(self::$lang_codes[$lang_code]) && empty($path)) ? self::$lang_codes[$lang_code]->sef : self::$default_sef;

Now it works at my site. - only if you enter the naked site with http://www.loytec.com, it switches to your browser's language site; e.g. on a German browser (or cookies are de-DE), it switches to: http://www.loytec.com/de

avatar oe1tkt oe1tkt - open - 11 Dec 2013
avatar elkuku elkuku - change - 11 Dec 2013
The description was changed
Description <p>There is already a posted message at forum <a href="http://forum.joomla.org/viewtopic.php?f=711&amp;t=801634">http://forum.joomla.org/viewtopic.php?f=711&amp;t=801634</a> about that behavior.<br> When that setting is on : "remove url language code" the redirect may not work when the following conditions are set:</p> <ul> <li>SEF is on</li> <li>"remove url language code" is on in the plugin languagefilter</li> <li>the url of the default language differs from the url of an other language, i.e. <a href="http://www.example.com/de/example1">www.example.com/de/example1</a> <a href="http://www.example.com/en/example2">www.example.com/en/example2</a> (associated menu item to /de/example1) When you are on the English site (language "en"), the above setting removes the url language code to <a href="http://www.example.com/example2">www.example.com/example2</a> Failure: When on the site <a href="http://www.example.com/de/example1">www.example.com/de/example1</a> and you enter the URL into browser: <a href="http://www.example.com/example2">www.example.com/example2</a> the link will be build to <a href="http://www.example.com/de/example2">www.example.com/de/example2</a> which causes a 404-page.</li> </ul><p>Solution:<br> Please change the following line at<br> plugins/system/languagefilter/languagefilter.php : (line 250)<br> Code:<br> // redirect if sef does not exists and language is not the default one<br> if (!isset(self::$sefs[$sef]) &amp;&amp; $lang_code != self::$default_lang)<br> {</p> <pre><code> //LOYTEC patch TK++ 2013-12-11; if path =""; then switch to the next language // $sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]-&gt;sef : self::$default_sef; $sef = (isset(self::$lang_codes[$lang_code]) &amp;&amp; empty($path)) ? self::$lang_codes[$lang_code]-&gt;sef : self::$default_sef; </code></pre> <p>Now it works at my site. - only if you enter the naked site with <a href="http://www.loytec.com">http://www.loytec.com</a>, it switches to your browser's language site; e.g. on a German browser (or cookies are de-DE), it switches to: <a href="http://www.loytec.com/de">http://www.loytec.com/de</a></p> <p>There is already a posted message at forum <a href="http://forum.joomla.org/viewtopic.php?f=711&amp;t=801634">http://forum.joomla.org/viewtopic.php?f=711&amp;t=801634</a> about that behavior.<br> When that setting is on : "remove url language code" the redirect may not work when the following conditions are set:</p> <ul> <li>SEF is on</li> <li>"remove url language code" is on in the plugin languagefilter</li> <li>the url of the default language differs from the url of an other language, i.e. <a href="http://www.example.com/de/example1">www.example.com/de/example1</a> <a href="http://www.example.com/en/example2">www.example.com/en/example2</a> (associated menu item to /de/example1)</li> </ul><p>When you are on the English site (language "en"), the above setting removes the url language code to <a href="http://www.example.com/example2">www.example.com/example2</a><br> Failure:<br> When on the site <a href="http://www.example.com/de/example1">www.example.com/de/example1</a> and you enter the URL into browser: <a href="http://www.example.com/example2">www.example.com/example2</a> the link will be build to <a href="http://www.example.com/de/example2">www.example.com/de/example2</a> which causes a 404-page.</p> <p>Solution:<br> Please change the following line at<br> plugins/system/languagefilter/languagefilter.php : (line 250)<br> Code:<br> // redirect if sef does not exists and language is not the default one<br> if (!isset(self::$sefs[$sef]) &amp;&amp; $lang_code != self::$default_lang)<br> {</p> <pre><code> //LOYTEC patch TK++ 2013-12-11; if path =""; then switch to the next language // $sef = isset(self::$lang_codes[$lang_code]) ? self::$lang_codes[$lang_code]-&gt;sef : self::$default_sef; $sef = (isset(self::$lang_codes[$lang_code]) &amp;&amp; empty($path)) ? self::$lang_codes[$lang_code]-&gt;sef : self::$default_sef; </code></pre> <p>Now it works at my site. - only if you enter the naked site with <a href="http://www.loytec.com">http://www.loytec.com</a>, it switches to your browser's language site; e.g. on a German browser (or cookies are de-DE), it switches to: <a href="http://www.loytec.com/de">http://www.loytec.com/de</a></p>
Status New Closed
Closed_Date 0000-00-00 00:00:00 2013-12-11 16:35:20
Labels Added: 000-CMS
avatar elkuku elkuku - close - 11 Dec 2013
avatar elkuku
elkuku - comment - 11 Dec 2013

Hi

This repository is for the Joomla! Issue Tracker application. Your issue pertains to the Joomla! CMS, please report your issue at https://github.com/joomla/joomla-cms/issues/new

Add a Comment

Login with GitHub to post a comment