10th Jan2013
Author: Gyro

Why I hate Joomla – Episode 1: URL suffix

Today I had really good fun with Joomla, that is, if you consider cursing and face-palming to be fun.

I have been using CMS systems since 2000 when I first installed php-Nuke. Shortly after that I used xoops to create a website for my clan, xoops is still one of my favorite CMS systems actually, even though WordPress is simply the best IMHO.

I did use Drupal, and actually liked when the developers split and Joomla was born. Now, I have started hating Joomla shortly after it was released. Main reason being their elitism in the forum, it seems that everyone has to comment but no-one actually comes up with genuine solutions. I would never even open their website again, had I no customers with Joomla websites, but since I do, I am on and off forced to deal with this piece of sunshine CMS.

So, now to the 2nd reason of probably 100+ to come:
I have just spend about 4 hours searching for a solution to get Joomla 1.5 to add a trailing slash (/) to the URL, instead of the default .html suffix. I found quite a lot of threads on the Joomla forum discussing how one could add a trailing slash instead of the .html suffix, and once again each thread was gang banged by Joomla Gurus making dumb a…smart comments, and a solution was nowhere to be found, unless you want to use a plugin. I swear, I would have slapped a few of them, were they near me when reading their useless comments… of course I can use a plugin like sh404 that completely hijacks your site and URL structure, but I was looking for the solution, not a work around!

So, after those 4 hours I finally got my Geany out of the bottle and did a few in-file searches, to find the files with the lines that does all the magic.

It is the router.php located in includes/router.php, open it and look for the function &build($url), and change the following within that function:

if($app->getCfg(‘sef_rewrite'))
{
//Transform the route
$route = str_replace(‘index.php/', ", $route);
}

To this:
if($app->getCfg(‘sef_rewrite'))
{
//Transform the route
$route = str_replace(‘index.php/', ", $route).'/';
}

Next, open libraries/joomla/document/html/renderer/head.php and look for this:

 if(!empty($base)) {
$strHtml .= $tab.'<base href="‘.$document->getBase().'" />'.$lnEnd;
}

change the above to this:

 if(!empty($base)) {
$strHtml .= $tab.'<base href="http://'.$_SERVER[‘SERVER_NAME'].'/" />'.$lnEnd;
}

You may have to modify this part a bit (maybe https, or if Joomla is installed in a sub folder, etc.), basically you should have your Homepage URL in the baseurl meta tag in the head section of the source code. :)

That's it! It really is that simple :shock: which makes me even more furious :shout: … I mean appreciative… thinking about all the super smart comments I found in the Joomla forum. I was about to go back to the Joomla forum to post my solution and tell those "Joomla Gurus" how full of sunshine they are, but then I remembered that I got this blog.

Oh, you need to disable showing the URL suffix in the Global Configuration, of course!

Enjoy! :hehehe:

p.s. Operating a blog is a fine form of anger management… :crazy:

2936

Keep Me Going
Your Name / Website:
Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW



2 Responses to “Why I hate Joomla – Episode 1: URL suffix”

  • Gyro

    I wonder if anyone (except my client) is still using Joomla 1.5 and wants to have a trailing slash that replaces the .html suffix at all, else this post will serve the sole purpose of assisting me in venting some steam ;)

    If you are using another Joomla version and for some reason you cannot figure out how to add the slash to the end of SEF URLs, drop me a line with the Joomla Version, and I will have a look for you… it took me 5 min to figure it out in Joomla 1.5 (after trying to find the solution on the joomla forum and other websites for 4 hours), I am sure I can also help you with another version.

  • January 11, 2013 05:20
    I wonder if someone (except my client) is still using Joomla 1.5 or wants to have a trailing slash that replaces the .html suffix at all, else this post will serve the sole purpose of assisting me in venting some steam ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

What is 5 + 2 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)