3

I set up Joomla to access it through a reverse-proxy. Everything works fine except the HTML has a <base> tag pointing to the real domain name. The browser changes relative links like /signup into fully qualified URIs using the <base> href value. All of the links on the site are relative. How do I prevent Joomla from inserting the <base href="..."> tag into the <head> of the document, or else how do I set the value to the domain that has the reverse-proxy?

I tried setting public $live_site in configuration.php but it didn't change anything.

I tried turning off "Use URL Rewriting", but it didn't change anything.

Research: https://duckduckgo.com/?q=joomla+reverse+proxy+base+tag&ia=qa

3

I found this answer, but I don't think it's permanent.

https://forum.joomla.org/viewtopic.php?t=354052#p2725317

To remove the base tag in the header simply add this to your template file (index.php)

$this->base = '';

I edited public_html/templates/yootheme/index.php.

1
  • Hey Chloe! Still a problem today and this is still a valid solution. Thank you for ending the research I had to do for hours to find out his little trick.
    – Socrates
    Mar 14 at 0:53
1

I haven't tried it recently, but the following should still do it:

$doc = JFactory::getDocument();
unset($doc->base);

It can be placed in your template's index.php, or in a system plugin. For your template, see if the one you use offers a way for your to add your own custom functions somewhere, so it can be maintained when you update it.

0
$doc = JFactory::getDocument();
$doc->setBase(JUri::base().'yourcustomurl/'); 
1
  • Thank you for contributing, Lumavi, please take our tour and read How to Answer. The system has automatically flagged your answer as low-quality because of its length. We generally want to collect answers that are not just correct, but educational. Could you please explain a bit more about your snippet? How does it work? Does it provide an advantage over other answers? Did you try another of the answers and it didn't work until you used this technique? Any valuable insights that you have will help researchers far more than a code-only answer. You may edit your answer at any time.
    – mickmackusa
    Feb 5 at 1:40

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.