Joomla 3.7(?) to 3.10.5 Legacy router issue fix
So, our site articles' urls needed the category id to be removed (only, not the article id, as removing both causes a 404).
Here is the solution that worked for me, on Joomla 3.10.5, but it might be the same from 3.7 up (If not fixed in 4.0).
Legacy router - path: @www/components/com_content/helpers/legacyrouter.php
Hacking the legacy router, and deactivate appending the category id to the segments array by commenting out line 199 in the legacy router and replacing it like this:
//if (!$advanced && count($array))
if (false)
Tried these solutions
Defaulting $advanced
to 1 and more, and other solutions in these links:
- https://vincentping.com/en/remove-category-article-id-from-url-in-joomla-3.html
- https://stackoverflow.com/questions/26168517/get-rid-of-id-category-and-article-from-url-joomla-3-3-3-4-3-5 ... did not work for me:
You can see the result here: https://new.ac-news.org (under construction)
As hacking the legacy router was a last resort not recommended solution:
- Was there a better way to do this?
- Should I provide my
.htaccess
code and the list of plugins I used to try and fix this properly?
Thank you