Call Us: 512.271.5221

15
November
2018

Prevent Joomla Multilingual Language Code within external files

If you have your website setup to be multilingual, then you probably have the System - Language Code plugin enabled.  However, this can cause issues if you want to directly link to a file or non-Joomla folder on your site.  Some examples are direct links to multimedia (images, PDF, videos), or navigating to other installations like a store or Mautic that you have in a subfolder.  

Unfortunately, the solution I used is a hack of a core Joomla file which is not ideal.  If someone knows a better way, please add in the comments.  The only page I found when researching was on StackExchange but it didn't address external links.  We use Watchful.li for montioring, so we have just added the file path to their plugin so we get an email alert if it is overwritten.

Here is the hack in /public_html/plugins/system/languagecode/languagecode.php :

After line 28:  

$app = JFactory::getApplication();

 

Add: 

$myUrl = JUri::getInstance();
$myPath = 'mautic';

 

and on line 31, change from 

if ($app->isClient('site'))

to

if ($app->isClient('site') && strpos($myUrl, $myPath) !== false)

 

 

Categories: Joomla Core

certified web designer

Get Started with YellowWebMonkey

Invalid Input

Invalid Input

Invalid Input

Joomla Certified Administrator