in Elftronix

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!

Care and share, let's call it fair! -David

Twitter Button Facebook Button Google Button LinkedIn Button

Write a Comment