Prevent Joomla Multilingual Language Code within external files

J3.x-Language-Code-Plugin-en-sm2.png

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)

 

 

About YellowWebMonkey

YellowWebMonkey Web design offers reliable website design, SEO and digital marketing services for Joomla, WordPress and Shopify sites. We strive to be a one-stop shop for all your web needs.

Recent Posts

Follow Us