Written by on

Recently, through a tip from one of my readers (Teodor Bochev), I stumbled upon a blogpost showing a simple solution to get rid of database-ID's in your Joomla URL's. From an SEO perspective this is usually desired, as the URL's are much cleaner then.

Disclaimer: This method is not officially supported, and there may be issues. Use at your own risk.

It seems this feature has actually been sitting inside Joomla for many years, but was never actually activated. The feature is called Advanced SEF. Though you should use it carefully, it should work well in most cases. Eventually, the routing changes that Hannes Papenberg is working on should also make this solution superfluous, but untill then this might be a nice solution.

The solution requires a small change to the core code, but unlike other core overrides, Joomla updates will leave the mechanism intact! Here is how it works. First, go to a site where you have an issue with these URL's. Say you have an article located at www.example.com/blog/33-article-with-id. Remember this URL so you can check the result when you are ready.

Look up the following file in your Joomla administration: administrator\components\com_content\config.xml. This file controls the options that are available in the Options button in the Articles Manager. What we are going to do is to simply add a new option, nothing else. Then add the following code to it:

<field name="sef_advanced_link"
    label="Sef Advanced Mode"
    description="Remove ItemID from Content URL?">
        <option    value="0">JNO</option>
        <option    value="1">JYES</option>

Actually it is not important where you put it, as long as you put it within the fieldset. I put it just in front of the first field, but you can put it anywhere you like if this makes more sense to you. If you now go the options in the Articles Manager, you will see the field there:

You see that you now have an extra option to enable SEF Advanced link. Keep in mind that the only thing we changed is to offer a way to show the switch to Advanced SEF. When we enable it (set it to Yes), we enable code that is currently already present in the Joomla core. So even if a Joomla update wipes out our update to the config.xml file, the actual feature has already been enabled, and it will remain active. You will only lose the option in the article's options, but that is not a problem anyway.

If you now check your URL with the ID in the database you will see that it is now available without numbers as www.example.com/blog/article-with-id. You may still found that the URL with the ID is still available if you type it in, but the canonical URL refers to the URL without the ID, so this is no problem anyhow.

So, it seems this may be a nice and simple solution to get rid of URL's with ID's. Remember that In Joomla 3.6 or later there may be updates to the Joomla Router that make this solution superfluous, and make sure to test if the solution really works for you. Best use is probably for new sites. For existing sites, it is less advised, even though the canical URL's point to the correct URL's anyhow.

For those interested, here are some links with more information about the feature: