1

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:

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

3
  • 1
    Welcome to JSE, Mayou. I want to make sure that I am interpreting your question properly. Are you expressing a problem and also solving it by replacing line 199 of the legacy router? If so, then I have a couple of concerns. 1. A question must not include its resolving advice. 2. We should not be advising researchers to hack core files. Now, to correct the presentation of your question, you can either 1. explain that you are not happy with your current hack and ask others to provide a more stable solution or 2. remove your solution from the question and post it as an answer.
    – mickmackusa
    Feb 6 at 20:35
  • Please take our tour to familiarise yourself with how this Stack Exchange community works. It would also be a good idea to read the help pages here relating to how to ask.
    – mickmackusa
    Feb 6 at 20:45
  • Hello @mickmackusa - Understood, I will add that I'm indeed not happy to have had to hack the legacy router, and ask for a better solution... Thanks Feb 8 at 16:22

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.