How to remove ID from URL in Joomla 2.5-3.7

There is a new option in Joomla 3.8.2 allowing to get rid of ID in URLs (thanks to Ian who discovered it). If you have an older Joomla version and unable to update to 3.8.2 or higher follow the steps provided below:

Open components\com_content\router.php in an editor and make a small changes:

in function ContentBuildRoute(&$query) replace line 27

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


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

in function ContentParseRoute($segments) replace line 208

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


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

Comment out lines 228-232

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

so it would be

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

That is all. I tested this on my Joomla 2.5.4 test site and looks like it works, but I cannot say that it works in all the cases.

Some explanation

If you tried the method described above and it works for you, you could leave it as it is and close this page, but if you interested in some explanation please read below.

As seen from lines 27 and 208 Joomla Content Component uses ‘sef_advanced_link’ parameter, so setting this parameter to ‘1’ eliminates the need for changing this lines. It could be done by adding the following XML to ‘fieldset’ section of administrator\components\com_content\config.xml:

<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>

and then setting ‘Sef Advanced Mode’ to Yes in ‘Article Manager Options’ window:

Remove ItemID from Content URL

Please note that setting default=”1″ in XML does not take an effect for some reason.

What concerns lines 228-232, if I leave them uncommented, ID disappears from URL and single articles open fine but when I trying to open a category not linked to some menu item I get “404 – Article not found” error message. I cannot say for sure, but I think that Joomla developers added ‘sef_advanced_link’ parameter but didn’t tested it well enough, so, probably, they will fix this code in future releases.

155 Responses to How to remove ID from URL in Joomla 2.5-3.7

  1. Wendy says:

    Very nice… new blank install 2.5.4 fixes issue. Anyone understand why joomla put this in the router.php file, what’s the purpose?

    1. dmitriano says:

      Not clear to me what you mean, but I added ‘some explanation’, probably it would be helpful.

    2. F. Saskiano says:

      ALso works fine for me, Joomla! 2.5.8 – Thank you! Installed in functional but not yet live site.

      But: in order to keep my core code pristine, I would prefer to use this fix in a standard override – but when the “fixed” router.php is placed in this folder:


      it does not work. It ought to, as any component file can be overridden, AFAIK.


      TIA for your help!

    3. bugil says:

      Thanks the trick

      1. Ashiq Ullah says:

        This is not working for joomla version 3.7

  2. Alexandru says:

    Yes works for me too 2.5.4
    Great tip, thank you very much !

  3. Tomatico says:

    excelent. Perfectly work on joomla 2.5.4. Thank you for the tip

  4. Works perfect on joomla 2.5.5 and 1.7.3

  5. Eric says:

    Since the time that i searched this tip, thanks a lot !

  6. Tyler says:

    Worked great for me on my landscaping site!

  7. jonson josnon says:

    Works perfect , quick and easy , thanks for this great article

  8. Andy says:

    solved my problem – thanks

  9. worked great thanks – but be careful doing this to a live site as any old links will no longer work i think
    also updating joomla would probably mess this up however works great if you dont want an SEF extension installed (which would do the same if you wanted without code changes)

    1. dmitriano says:

      On a live site you could use redirect 301. Some example that I did with Apache 2 using .htaccess file:

      RewriteRule ^recipes/(\d+)-([\-a-zA-Z0-9_]+)/(\d+)-([\-a-zA-Z0-9_]+)/?$ recipes/$2/$4/ [NC,R=301,L]

      where “recipes” is the alias of some menu item associated with category view.

      1. Jim says:

        I wouldn’t suggest redirecting a dead link, because then Google and other search engines think that the link isn’t broken, so they’ll process that and the working link. And double content = bad rating. At least that’s what I heard. Just submit a new sitemap with the working links. You can also make an error page with a link back to your homepage.

        1. dmitriano says:

          Hello, Jim!
          I do not know for sure, probably you are right, but I think that Google should not treat 301-redirects as double content.

  10. Carlos says:

    I WOULD KISS YOU IF I COULD ( Figuratively Speaking )!!!!!!!! It is because of people like you that make the internet such a beautiful place! This worked perfectly for exactly what I needed.

  11. Chris says:

    Thank you!

    You’re a true Joomla gangster.

    1. DEVPROCB says:

      Confirmed working on Joomla 3.0 as well

  12. edrick says:

    perfect…Many thanks from me..

  13. Rob says:

    doesnt work on 2.5.6 🙁

    1. dmitriano says:

      I did not tried it on Joomla 2.6 yet. What happening?

    2. J says:

      Does anyone have a solution for Joomla 2.5.6?

      1. Prosolusindo says:

        Works for me.. maybe you have shown article that not linked on menu. that’s why it causes error 404

  14. geleto says:

    This works on J2.6, but only partially.
    If you type the article link without the id – it works fine.
    If you type the article link with the id – it also works.
    But all the links pointing to the article, for instance from latest news, category layout, search, from the article itself (if title is link) – all have the id in them.

  15. Zuka says:

    You helped me alot. Everything working good on J. 2.5.6
    Does any of Joomla developers reads this tips…

  16. modra ideja says:

    Wow, so much trouble for a small but important detail…

  17. Pratap says:

    yes..its works perfect
    Thank you buddy!

  18. Polfeck says:

    Thanks dude, worked perfect on J 2.5.4

  19. Taptap says:

    Thank you very much.

  20. hmirs says:

    I test this solution in Joomla 2.5.7 and is work just fine ! Thanks !

  21. Daniel says:

    It works alright, next problem, is the fact that joomla won’t, reconize the HTML override file in template/HTML/com_content/router.php file, and for it to work, you have to override the original file.. Making it “dangerous” to update..

    1. dmitriano says:

      I think, the only solution is to change router.php manually each time you upgrade Joomla. Certainly, it is some kind of a problem.

  22. E-on says:

    thank you this works in 2.5.7 and solves a dilema of creating a lame menu item everytime.

  23. Stefanos says:

    Very helpful. Works nice on my site.

  24. gaby says:

    Works very good, Thank you!

  25. Faisal says:

    Thanks for this tutorial

  26. Agustin says:

    Excelente.! lo he probado en mi web de prueba (versión J2.5) y funciona de maravilla. Actualmente estoy en J1.5 pero ya voy cambiando. Elimina los ID de la URL perfectamente… GRAN APORTE.!!

  27. Great tip, i’ve been googling for this. We are “Keep-It-Simple” Joomla Solutions provider and prefer not not use 3rd party extensions unless necessary. We only needed to kill item id’s – otherwise Joomla native SEF works fine for most projects.

    Thanks again for the insight and sharing

  28. Brandon says:

    i’m getting a 404-error… something about the parent category 🙁

    would like to avoid using a 3rd-party SEF component/plugin just to remove the ID# from articles and categories in URL, but may have no choice. hopefully MijoSEF won’t slow me down too much.

  29. Hi Admin,

    Great tutorial! works like a charm on my Linux Tutorial Website:

    More Power! and Thank You!

  30. Agustin says:

    Lo he probado en mi versión, aún demo (version Joomla 2.5.8) y funciona de maravilla… tremendo aporte a la comunidad 🙂

  31. Jorge says:

    Hi. I just tested it in Joomla Joomla! 3.0.2 Stable and it looks like working perfect: I don’t see any bug in my test site.

    Hola. He hecho un test de esta solución en Joomla 3.0.2 y creo que funciona perfectamente: No veo ningún bug en mi site de test.

  32. E.jr says:

    This works very nicely!
    Thank you for the awesome tutorial.
    I was tired of the SEF components that mess the whole site up, this is a very easy and clean method to simplify the URLs.

  33. nibelungen says:

    I tested the method on my Joomla 3.0 site. It’s good but it seems only to work if there’s a hyphen in the article alias, and I can still access the same page if I type it with article id on the address bar.

    For example, and both work

  34. nibelungen says:

    Another interesting thing that happens with this method is you can have endless article aliases in the url.

    So, if you have an article with the alias “article-1,” this url:

    and this one:

    will redirect to the same page.

    1. dmitriano says:

      I do not know for sure, but probably content component router initially works in this way.

  35. Willian says:


  36. Mantas Uosis says:

    these spells act on Joomla 3.0.2. both links “/ID-nameofarticle” and “/nameofarticle” will get you to the same article…

    but in the tile of blog articles link remain with ID.

    still thanks 🙂

  37. thank you very much. it help me alot

  38. rjab oussama says:

    thank youuuuuuu very much.

  39. Big Ben Jr says:

    Thank you very much, still working !

  40. Khuong Duong says:

    Thanks for share. Work great !!!

  41. Teodor Ovcharov says:

    Thank you ! Works on Joomla 2.5.9 !

    Should I be worried about future Joomla updates ?

    1. dmitriano says:

      You need to apply this changes each time you update Joomla.

  42. John Camelo says:

    Excelente tutorial, funciona en Joomla 2.5.9.

  43. Jorge M says:

    Hi. I think this workaround is no longer valid in Joomla 3.1 beta 3. I’m trying to do it and the code

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

    is different. Can someone check it?
    Thanks. Jorge M

  44. Jorge M says:

    Sorry, my bad, i was doing a mistake, It’s working in Joomla 3.1 beta 3.

  45. Camilo Rosero says:

    Thank youuuuuuuu!!!!!!!!

  46. Mathias says:

    Not work of my site pleace help me 🙁


  47. Jorge says:

    I just updated my site to joomla 2.5.11 and the workaroung is no longer working. What can I before google start getting the change in the urlS?

    1. dmitriano says:

      Hi! check the content of components\com_content\router.php probably this update overwritten your changes

  48. Mathias says:

    Hello dmitriano with the Sef urls that we want to solve otherwise specifically about the htaccess should go. send me an email if you would like to join

  49. Jorge M says:

    Thanks Dmitriano, it’s working now in joomla 2.5.10.
    I’m doing testing and i cannot make it work in joomla 3.11 despite it worked in joomla 3.1 beta.
    Can someone do another testo to verify? Thanks

  50. darkman says:

    Many Thx, i have tested it on joomla 2.5.11 and it rocks !

  51. m says:

    Jorge, I cannot get this to work on 3.1.1 either. If anyone knows of a fresh workaround, please share!

  52. max says:

    for me its working that means not showing the id number but one error comeing when i clicking the given url the error is ” 404 Article not found “. why this error coming in my to solve this error

  53. JB says:

    Thanks for your article. I tried this on Joomla 3.1.1. ID gets removed from URL but it results into 404 error. Any suggestion?

  54. AG says:

    Thanks, working on joomla 2.5.11

  55. Gerhard says:

    Hi, this doesn’t work for me on Joomla 3.1

    I tried both, template override and editing the core router file in com_content.

    Anyone got this working in J!3.1?

    1. F. Saskiano says:

      Modifying the router.php file works fine in 3.1 – buit – using a standard template override apparently does not work. Make sure both your browser and Joomla! caches have been cleared. I see no reason why a standard template override should not work…

  56. Great article, very easy to do

  57. Al says:

    Its NOT working for me, I have 2.5.11
    I’ve followed the instructions above but I still have a number in my web link menu?
    Please help !

    1. dmitriano says:

      Strange… It works for me on Joomla 2.5.11.

  58. Innocent says:


    It doesn’t seem to work for joomla 2.5.8.

    1. dmitriano says:

      Hi! Two people said that it works for joomla 2.5.8. See comments above.

  59. responsive joomla says:

    this solution causes, that every article is reachable by 2 URLS, so it produces duplicate content, which is a no go.
    without id:
    with id:

    1. dmitriano says:

      It is not a problem at all. Use 301 redirect. You could add the following to .htaccess (if you are using Apache)

      RewriteRule ^yourcategory/(\d+)-([\-a-zA-Z0-9_]+)/(\d+)-([\-a-zA-Z0-9_]+)/?$ yourcategory/$2/$4/ [NC,R=301,L]

      1. The router hack works, but the URLs which have already been indexed by Google are still showing with numbers.

        Tried this extra rewrite rule, but still shows the numbered articles.

  60. ajAdmin says:

    Works in Joomla 2.5.11 as well. Great article. I paraphrased with a link back to this article in our developer news area of I hope you do not mind.

  61. Steven says:

    Does anyone know how to get this to work in 3.1?

    Doing the above breaks Joomla – the URLs generated do indeed lack the IDs for categories and articles, but Joomla can’t actually find the article/category without the IDs:



    1. Alex says:

      Hi Steven,
      I get the same error after modifying router.php, could you solve it?
      I tried adding a parent category, but no luck,

      thanks for your help.
      Kind Regards,

  62. shashank singh says:

    Its not working in joomla 3.1
    plz provide the solution

  63. Ankit says:

    Brilliant!!! It works great

  64. After updating the version 2.5.11 to version 2.5.13 appeared articles IDs in the URL, big problem for Google indexing URLs since they are different and I had to redirect them all to appear Article ID in the URL . But with this brilliant explanation the problem was solved and now the URLs are as before the upgrade.

    ::: Thank You ::: Best Regards :::

  65. Kim Mã DPA says:

    I tested in Joomla 2.5.11. It works.
    and now I don’t need sh404sef component.
    Thanks so much.

  66. Nishant singh says:

    Thanks a ton. Worked out well. I am using 2.5.11. Really appreciate this article. 🙂

  67. Works in Joomla 2.5.11! Thank you!

  68. Miranda Zobel de Ayala says:

    It works in Joomla 2.5.14 but with the following error – “Notice: Undefined index: id in C:\wamp\www\components\com_content\router.php on line 282”. I could suppress error reporting in my localhost but what about in my live site? Anybody knows of the probable future impact of this error in live site? Thanks!!

  69. yasar says:

    It works for joomla 2.5.14 .. Many many thanks!!!!

  70. Markus says:

    How it works for Joomla 3.1.5?

    1. dmitriano says:

      Hello, Markus!
      This method works only for Joomla 2.5-3.0. It does not work for Joomla 3.1 and higher. I wonder if someone have ideas about Joomla 3.1.

  71. smarn says:

    It works for 2.5.14..! Thanks A lot dmitriano !!

  72. ubuz says:

    Great! very good on Joomla! 2.5.14

  73. Astrid says:

    The Sef Advance mode option doesn’t appear here. Using Joomla! 2.5.14

    I have tried this little hack before on older Joomla! versions, and it worked like a charm! Any ideas as to why it doesn’t do anything for me now?

    Thank you!

    Best, Astrid

  74. Great! very good on Joomla! 2.5.14

  75. Kard Nails says:

    Yes, works all right in 2.5. Thanks for this.

  76. A'sio says:

    Hi Developers.

    Very for this solution, But there is one issue while creating category blog, it shows only a blank page.

    What I think is, this perfectly linking single article in a menu, While making a category blog. OOps

  77. Thong Tran says:

    Thanks for the post, dmitriano.

    I’ve wrote a blog post with other solution which don’t need to make a core-hacking. Please take a look at Remove Joomla 3 Tags ID in the URL

    Thong Tran

  78. stobyland says:

    This solution worked till now. But with the last update (2.5.17)no longer works.

  79. Floyd611 says:

    Hi all,
    I have placed the “router.php” file in:
    /templates/MY-TEMPLATE/html/com_content/router.php and not working.
    Appear always the ID of the article.

  80. Rooo says:

    Not working into joomla3.1

  81. Alex says:

    Thank you very much! Great and simple article. Working with Joomla 2.5.16.

  82. Youkepo says:

    It works for me on Joomla 3 but when i click the title, it will show 404 Pages

  83. thạnh says:

    Thanks you verry much!!!!!!!!
    A article useful to everyonce.
    I love you!

  84. MAGED says:

    I tested on my website which is online, already published, and now articles are 404.
    Please help.

  85. MAGED says:

    with version is Joomla! 3.2.1.
    all articles who linked with a menu are working fine, only articles in Category Blog showing 404 error.
    I have already made on .htacces file.
    Any idea?

  86. bad boy says:

    the article alias must be a minimum of two words! 😉

  87. Kala Mohan says:


    Thanks for this wonderful post. I tried in J3.2.3 and getting 404 page. Any other workaround available for this.

  88. Galisha says:

    I also tried in joomla 3.2.3
    it works for some pages, but not all.
    It is strange

  89. I am what I am says:

    It seems to be working fine in Joomla 2.5.19. It didn’t seem like it at first, but I checked it out and it looks fine.

  90. tried to find support from Joomla forum, other forums as well as googled to fix the article ID number in each URL in Joomla, yet I still could not fix

  91. David says:

    Man, I’ve got Joomla 3, and can’t figure it out. I don’t know why they do it. It just doesn’t make sense!

  92. Ryan says:

    It is not working for me after updating to Joomla 2.5.20

    I redid router.php after the update, but nope. Not working 🙁

  93. Andrea says:

    At the Joomla 3.3 doesnt work. The explanation (i think) is because at the config.xml file, the sef configuration doesnt exist anymore.

  94. David Kley says:

    Without an extension, the only way to remove the article id is to create a menu item leading to the article. Once you have done this, the id will disappear, and will also get rid of the leading category URL.

    Example before:
    Example before:

    IMO this is much better for seo, unless you need the subcategories displayed

  95. Sandro says:

    Wonderfull works great in all my websites

  96. amziyal says:

    This can’t seem to be working on Joomla 3.24. Please advise.

  97. DavidXian says:

    Work on Joomla 3.3.6 just by changing sef_advanced_link value from 0 to 1. But just as the others, both with-id and without-id links are accessible.


    Work on ‘Category Blog’ and ‘Category List’ too. But didn’t work on Tags and ‘List of tags’ (not 404 error though, just “No matching items were found.”)

    NOT working:

    1. Evelynrad says:

      Have you test by creating menu of “artistlist”?

  98. I am what I am says:

    I just upgraded to 3.3.6 and it still works. You have to clear your cache.

  99. Guenscher says:

    Hello, I can’t do it right because when I treminated to put these codes above I can see the Sef Advanced Mode im my cpanel

  100. Guenscher says:

    Please someone can help me friendly?

  101. Guenscher says:

    Take a look of this link so I want to see it like . Please help me my friends. It’ 3 am in my country so I can’t sleep because I want to resolve it.

  102. aldy says:

    not working at joomla 3.2.3

  103. Tony says:

    i’d like to thank a lot for this post.
    It fixed my issue!!!
    I use joomla 2.5.28 and it works fine!
    Very, very thanks
    Best regards

  104. Susan says:

    To be frank, I cannot understand what you say partially. I’m looking for an easy way to remove the article ID of Joomla article. I’m searching on the web and have found, telling me how to do this using code. However, I want something easier. Is there any suggestion?

  105. pepperstreet says:

    1.) You might create single Article MenuItems… either in a hidden or visible menu. Most applicable on sites with less items… but you might also streamline this tedious process with an extension:
    Auto-Menus with Kazaam!
    Or something like Add-to-menu
    2.) Try a 3rd-Party SEF extension:
    Either a bigger solution if you need more features and options. i.e. sh404SEF, MijoSEF, and others…
    Or a specific solution like “Direct Alias” by AlterBrains. Available in free and pro version.

    Good luck!

  106. You’re a true Joomla gangster.

  107. Gaurav Agrawal says:

    I have used your trick to hide ID’s from URL.It works fine when I choose “Category List” to display in non-display menu.But when I used to “Single Article” in menu,it redirects to 404 page and error display is:

    Please help me with this problem.

    Thanks in advance.

  108. Not working for me. Not sure if i am missing something. I have got Joomla! 2.5.14 and also AceSEF plugin installed. Please let me know if it affects the SEO friendly structure of URLs

  109. I am what I am says:

    Just updated to 3.4.4 and seems to be working fine.

  110. I use Joomla! 3.4.8 Stable and the hack of dmitriano works fine for me.

    Thanks to dmitriano

    by Richard from Knot Together

  111. Paulo says:

    Thank you. It’s Work!

  112. Ran says:

    I have been using this hack for years but just found that it only work if the Alias are more than one word. For example, if the URL is you’ll get an 404, but if you use it will work. This only applies to Articles alias, not menus.

    1. Ran says:

      I should have added that is dose no applies to tags URL as well.

    2. CH09 says:

      Did you find a solution for one-word alias ?

  113. Paulo says:

    Not funf in joomla 3.5.1

  114. Paulo says:

    Now it’s funf!!!

    Create the file config.xml, add this code above and upload to administrator\components\com_content


  115. kostas says:

    Thank you very much, still working !

  116. ramonsantos says:

    Thank you very much, you resolved my problem. 🙂

  117. Kamil N. says:

    It’s still needed and still works on 3.6.

  118. Anton says:

    Still not work on Joomla 3.6.2. Help!

  119. expert67 says:

    Joomla 3.5

    From : (line 34)
    // Get a menu item based on Itemid or currently active
    $params = JComponentHelper::getParams(‘com_content’);
    $advanced = $params->get(‘sef_advanced_link’, 0);
    // Get a menu item based on Itemid or currently active
    $params = JComponentHelper::getParams(‘com_content’);
    $advanced = $params->get(‘sef_advanced_link’, 1);

    From: (line 294)
    // Get the active menu item.
    $item = $this->menu->getActive();
    $params = JComponentHelper::getParams(‘com_content’);
    $advanced = $params->get(‘sef_advanced_link’, 0);
    $db = JFactory::getDbo();
    // Get the active menu item.
    $item = $this->menu->getActive();
    $params = JComponentHelper::getParams(‘com_content’);
    $advanced = $params->get(‘sef_advanced_link’, 1);
    $db = JFactory::getDbo();

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

  120. Ian says:

    Just updated to 3.6 and seems to be working fine.

  121. Kala Mohan says:

    This is working for J3.6.2 articles & categories. But not for tags. I am getting 404 error for Tags. Any help with Joomla Tag URLs.

  122. cars agadir says:

    I think this is very bad for SEO purpose (and i think remove the ID is mostly for SEO purpose)

  123. Iulian says:

    For new Joomla 3.7 working?

  124. Pete Lorocco says:

    Here’s the answer ppl.
    One of my students pointed me to this forum thread page, as she searched the answer- then came and asked me for help.
    Do this:
    You go to the administrator/components/com_content/config.xml file, and paste the following code:


    Save the file.


    Log to your joomla, and go to Global Configuration. Down the left side is a sidebar which has a bit of a heading “Component”. Look for “Articles”.

    Select it.

    You’ll see tabs in the upper area of the window. The second last tab from the right is “Integration”.

    Select it.

    When the content appears- the final ‘item’ will say ‘Sef Advanced Mode’. This freedom of choice! was created by pasting the code into the config.xml file.

    Select “Yes”, click the “save” button- and your Blog IDs are gone. It’s likely that this item could require attention, when you next upgrade Joomla- and the solution might not work on future versions.

    Reach out through my website- and I’ll provide an answer.


    Pete Lorocco

  125. very useful tip for me this is awesome

  126. It works in Joomla 3.8 ! Great job.

  127. Ian says:

    I just updated to Joomla 3.8.2 and this looks different. The file router.php does not include the same info as above. IDK if I am missing something but this file appears to have changed and this doesn’t work.

    It did work for me before but not now. “sef_advanced_link” is gone. Now there is “sef_advanced” and it’s only mentioned once in the file not twice like the old.

    I couldn’t find the lines:

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

  128. Ian says:

    O.k. I found a SOLUTION:)! Yay Joomla!
    go to articles>options>integration>url routing>modern>remove id’s from url’s>yes

    Clear caches and voila it’s gone. no more editing this file.

Leave a Reply

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