I have some custom components that specify images either in CSS or inline with relative paths:

<img src=\"images/loader.gif\">

The problem is that I have a multi-site configuration (I don't use any 3rd party extensions) where the site is defined to be a specific language. So when you go to the site say www.anothersite.com it is Spanish only. When you go to a url Joomla puts in the locale code according to what I setup in the Language manager. ie.


This is a problem with my custom components as now any images try to resolve to:


Which is incorrect as it is at:


I have English sites as well in my multi-site configuration so it is important to resolve to: www.anothersite.com/images/loader.gif or at least something consistent.

I don't want to incorporate the language switcher as each site needs to be a dedicated language plus I doubt that changes anything. I can certainly add the language locale to my code but that is not a very elegant solution. Is there a better way to do this?

  • I had the same problem, adding this code to correct the <base> was the correct solution. Thanks
    – Victor
    Sep 27, 2017 at 14:59

2 Answers 2


I haven't been able to reproduce your error, but you can remove the language code from the Language Filter Plugin by setting "Remove URL Language Code to YES. That will remove the /es/ or /en/ part from your URL.

Language Filter Plugin

You can also use absolute paths in the component with the JURI::root() string:

<img src="<?php echo 'JURI::root()'; ?>images/loader.gif">

This is probably because of incorrect <base> tag value that is auto generated by Joomla in multi language setup when SEF and URL Rewriting are ON. You can fix it by removing the Joomla generated <base> tag and then adding a new one manually.

Open your template's index.php file, inside the <head> tag, after the <jdoc:include type="head" /> add this code :

$doc = JFactory::getDocument();
unset($doc->base); ?>
<base href="<?php echo JURI::root(); ?>">

Tested with Joomla 3.6.5

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.