How to Add Trailing Slash “/” to Joomla URLs Without .htaccess

I wanted to add a slash “/” to the end of all the URLs on my install of Joomla¬†3.3.1. So that all the pages on the site would have an address like “”. As default, Joomla creates URLs without the trailing slash, ex. “”.

  • Confirmed still working on Joomla 3.6 and beyond.

Joomla URLs with trailing slash

This is possible to achieve with .htaccess, in my case however, I could not get it to work by pasting code suggested on the web to the default Joomla htaccess.txt file.

Luckily I found another workaround here, which I prefer anyway. The htaccess method will show links as “xx/page” and simply forward them to -> “xx/page/” per request. But this added code will add the trailing slash into Joomla itself, creating clean, working ¬†URLs.

We need to edit the site.php file. Do a back up first, and open up this file with your favourite text editor:


Look for the line “Set query again in the URI“, for me it was line 513 and replace the code:

// Set query again in the URI


// Set query again in the URI
$uri->setPath($route . '/');

That should fix it. The downside is, that if a future update of Joomla replaces the file with a new one, and you will need to do this again.

Please, let me know if it worked for you in the comments!

Caring is sharing.. thank you! -David

Twitter Button Facebook Button Google Button LinkedIn Button

Write a Comment


  1. Hello, great it works thank you very much! I have installed joomla local with xampp. But allow me this question – is it possible to get the trailing slash by joomla menu item type External URL, too? I have in my main menu 2 such menu types. For example my local domain is just yet http://localhost/en/, my external url is
    By mouseover on the external url within Firefox 54 it does not show the url preview with the trailing slash in the bottom left of the browser window? All other internal urls are showing with “/” at the end in the url preview. I would be very pleased for an answer. Kind regards Karin

  2. In 3.8.x the site.php has been moved and renamed.
    /home/user/public_html/libraries/src/Router/SiteRouter.php – starting at line 573

    • I’ve changed .htaccess by adding the entry which adds the trailing slash. Since OSMap can’t be configured to add the trailing slash thus creating a lot of duplicate content I decided to use the option you are describing. It works perfectly.