Remove the Joomla URL ID

Posted on

A search engine friendly URL means that it can easily be understood by people, and search engine robots. An article’s URL is usually made up of 3 sections divided by forward slashes. The domain, the category, and the title of the article. It looks something like this “”.

By having a search engine friendly URL you make it easier for your visitors to navigate your site. Your article will also be placed higher up on the SERP (Search Engine Result Page), since it has more keywords. This article will help you clean up your url if you’re using Joomla.

Remember to backup your website regularly, and make copies of files you’re about to edit.

SEF URL with Joomla

It seems like the creators of Joomla doesn’t want people to remove the ID for some reason. They pretty much remove the “hack/fix” in every update. I would suggest you just migrate to WordPress, unless you need Joomla for a specific reason. If you find a solution/problem, please share it in the comments, and I’ll try to help.


SEBLOD can help you with the ID. I haven’t tried it myself, but it looks promising. Read their FAQ before you install it. Also read this Forum post about changing the URL ID.

You can look for SEF Joomla extensions here:


Warning: This guide may cause duplicate content, so if you don’t know how to fix that yourself, you should try the extensions.


  1. Joomla 2.5.6 – Here’s a video tutorial if you would prefer that.
  2. Joomla 2.5.7+ – There are 2 instances of get(‘sef_advanced_link’, 0). Make sure you changes both.
  3. Joomla 3.0.2 – Changing get(‘sef_advanced_link’, 0) is all you have to do. (Be aware of duplicate content with the old and the new URL, read comments for more info.)
  4. This may not work on newer version of Joomla! Try SEBLOD, and changing the URL ID.
  5. Added Joomla 3.1 – step 4.

Step 1

Joomla 2.5

Copy “components/com_content/router.php”  to  “/your-template/html”, (if you don’t have a folder called html, you need to create it.) then continue on step 2.

Joomla 3.0.2: This is the only way I got it working. If you find another way, please let us know!

Edit “components/com_content/router.php“, then continue on step 2.

Remember, you’ll probably have to re-do this step every time you update Joomla.

Step 2

(Try rewriting the symbols if it doesn’t work.)

Change this:

$advanced    = $params->get('sef_advanced_link', 0);

To this:

$advanced    = $params->get('sef_advanced_link', 1);

Joomla 3 – You’re done! (3.1 see Step 4)

Joomla 2.5 – Continue Below

Step 3

Replace this:

if (strpos($segments[0], ':') === false) {
$vars['view'] = 'article';
$vars['id'] = (int)$segments[0];
return $vars;

With This:

/*if (strpos($segments[0], ':') === false) {
$vars['view'] = 'article';
$vars['id'] = (int)$segments[0];
return $vars;

Joomla 2.5 – Done!

Joomla 3.1 – Continue below, thanks to Phuoc Nguyen.

Step 4

You want to edit your router.php file:


->where($db->quoteName('alias') . ' = ' . $db->quote($db->quote($segment)));


->where($db->quoteName('alias') . ' = ' . $db->quote($segment));

Help Section

If it doesn’t work, there are a few common mistakes you may want to look into.

1. You may have to rewrite symbols in the code you copied.
2. You may have missed something, so make sure you read everything.
3. This guide may not work for your version of Joomla.

Founder of

29 thoughts on “Remove the Joomla URL ID”

    1. Yeah, that one is for Joomla 2.5.6, so it wouldn’t work.
      I’ve added information on how you can do it in Joomla 2.5.7.

  1. Well in fact for Joomla 3.0.2 you can go through and just replace the two lines of
    “$advanced = $params->get(‘sef_advanced_link’, 0);”
    “$advanced = $params->get(‘sef_advanced_link’, 1);
    and then you don’t need to comment out that other code which is great news

    1. Thanks for letting me know!
      I installed 3.0.2 to figure it out, and it seems like it won’t work with the template override. So until we find a solution, you have to edit the original file.

  2. Thx a lot! Works with 2.5.9 too, but you have to overwrite the original router.php at /com_content. So remember to backup the original, and to re-edit after update.

  3. Attention, duplicate content:
    After testing, i decided not to use this solution: It causes, that every article is reachable by 2 URLS:
    = without id
    = with id

    So this solution produces duplicate content, and google really dislikes duplicate content, so it is not search enginge friendly (SEF).

    1. Thanks for letting us know. I found this on Joomla’s forum.

      “You can easily avoid duplicate content issues with J! Core SEF by utilizing the “alias” menu types. If you have multiple menus which dictate, from a technical standpoint (since J! Core SEF is based on Menus, not section/categories/articles), multiple pathways to one piece of content, then by utilizing the “alias” menu type, you can resolve that as Joomla! will defer to the alias specified.”

      I haven’t tried it myself, but it looks like it should work.

      1. Yeah, but by doing this,. you don´t need to edit the router php at all, cause using that trick there will no be any id in the url. ,-)

  4. btw.: so i decided to use the “hidden menu bug/feature”* to get SEF URLs.
    * Link to each article in a menu that u don´t use on your site, the alias for the menu-item then will be used for the article-URL.

  5. Studying joomla makes you want to hit your head. Why? First, if you want to do a simple thing, you need to install a plugin or you need to touch the code. Second, plugins that fits to you are in commercial, they are not free. It’s so sad.

    1. I agree, that’s why I switched to WordPress. Sure there are still a lot of plugins, and coding, but the plugins are free, and there are plenty of tutorials.

  6. The system is easy and it works without problems with joomla 2.5, however there is something that many do not think, that the placement on search engines. The links are indexed with the id so when someone comes from google is likely 404s! Now if the links are a few you can use the redirect component cms, but if there are many? Maybe you should speak with the modification of the htaccess file, but you have to put that command to do with a single command to redirect all links without id? Thank you.

  7. Hey, with seblod 3 lists you can route without hacking anything. It’s awesome.

  8. Yeah, that’s right.
    You create a new List & Search Type and configuration, like the image.

    I have it working on a site, when a I finish it I’ll show you

  9. I would like to ask one thing about this issue. I search it on google but I didn’t find a clear answer.

    Why is a bad thing to have the id at the end of the URL?

    like that

    I understand that maybe someone needs very easy urls for the user to type them (no body does that anymore, but ok) but If, for any reason, you have to change the alias of the page you will not have a 404 cause joomla only takes the id (I think).
    So if you change to this, it should work anyway:

    Thanks in advance.

  10. I fixed this issue for Joomla 3.1. Problem come from query string of Joomla ^^.
    1. Like this post in step 1, 2 and 3
    2.Change code line 377 of router.php file:
    – From: ->where($db->quoteName(‘alias’) . ‘ = ‘ . $db->quote($db->quote($segment)));
    – To: ->where($db->quoteName(‘alias’) . ‘ = ‘ . $db->quote($segment));

    It work for me :)

  11. For some strange reason this didn’t work for me on 3.1.5:

    ->where($db->quoteName(‘alias’) . ‘ = ‘ . $db->quote($segment));

    So instead I was able to get it to work with:
    ->where($db->quoteName(‘alias’) . ‘ = ‘ . $db->quote($segment));

    I visually can’t see any difference but if anyone gets an error message try my code.

  12. I can’t make it work, did all steps twice to make sure i was not doing anything incorrectly.

    In my site the urls are modified as expected, removing the id from categories and articles, but i get an error 404 in all of them :-/

    Im using version 3.1.5 of Joomla

Comments are closed.