I've got a problem with my Joomla site.

I've got an anchor link in my template -- really simple, like this: <a href='#top'>Go to top</a>.

This works great for most pages on the site.

But on some pages (eg search), we allow URL arguments. On those pages, Joomla is rewriting the anchor link to remove the URL arguments. This means it no longer points to the current page, so it doesn't work as simply "go to top", it reloads the page without any parameters. This is not what I want.

All I want is a plain simple html anchor link. I don't want Joomla to be clever and rewrite the URL; it doesn't need rewriting.

Is there any way to stop Joomla from rewriting this URL?


2 Answers 2


Another idea would be to provide the right URL for the anchor. In your template you can do something like this:

<a href="<?php echo JUri::getInstance(); ?>#top">Go to top</a>

This will add the full URL of your current site in front of the "#top"

  • Thanks. This solved the problem. Seems like more of a work-around than a fix, but it's enough to get me back on track. Thank you.
    – Simba
    Commented Jan 28, 2016 at 15:23

You could try:

  1. Sourcerer http://www.nonumber.nl/extensions/sourcerer
  2. it enables you to wrap code in {source}Go to top{/source} - perhaps this will stop the rewrite
  • Looks like it might do the trick, but seems like it would be overkill to have to use a plugin for this. Thanks for the suggestion though.
    – Simba
    Commented Jan 28, 2016 at 15:23
  • Sorry - I misunderstood your question and thought it was in a module in the template rather than "In" the template index.php file - so my answer won't work.
    – iamrobert
    Commented Jan 28, 2016 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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