I have a Joomla extension running on 3.10 which fails on Joomla 4. The issue is that it generates URLs of the form /index.php?option=COMPONENT&view=VIEW&task=TASK&parameter=PARAM which generates a 404 error on J4. I've looked all over the place and can't find anything definitive on these questions

  1. Is there a way to configure J4 to accept this form of URL
  2. If not, what do I need to do to the extension to change it to work on J4

I looked at com_content (which will work with this form of URL) but got lost navigating it.

  • Normally, non-SEF URLs should not produce 404 errors (assuming the parameters are correct). Impossible to tell without seeing the code. How is the router implemented?
    – Sharky
    Apr 20, 2022 at 7:32

2 Answers 2


There are some backward compatibility issues in Joomla 4 when using Joomla 3 code: https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4

Furthermore are you sure that the 404 errors are caused by the URL structure?

I suspect that there is other code in your component that triggers the error. With a good IDE (like the commercial PHPStorm, or Visual Studio or Netbeans) in combination with Xdebug you can step through the code and see all variables and their values in each step. That way you can analyze where/why the Joomla 3 component is not working.

  • The reason I think it's the URL is the stack trace from Joomla debug mode. It's all in the Application and Router, with Router at the top JROOT/libraries/src/Router/Router.php:153
    – John B
    Apr 20, 2022 at 13:01

The answer is that somewhere in the processing, an href with a relative pathname is handled differently between Joomla 3 and Joomla 4. In Joomla 3, the base site URL is prepended. In Joomla 4, a menu item is prepended (probably the current menu item), which causes it to fail in some cases. In the case I described, the URL was a relative pathname generated within javascript. There are several solutions possible. One is to write a router to handle it. A quicker solution is to generate a full pathname including a correct menu item. The Joomla Uri::base method will get the base site URL. Factory::getApplication()->getMenu()->getActive()->route will give you the menu item subpath.

  • Does this question provide resolving advice? If not, then it is Not An Answer. Maybe I am misunderstanding your advice. Might you edit this answer to clarify the advice that you are offering about how to resolve the question? Apr 22, 2022 at 3:58
  • I updated the answer to show how to resolve this.
    – John B
    Apr 24, 2022 at 14:30
  • I'm currently struggling with the same issue. Thanks for the pointers; I'm still having a hard time figuruing out where I need to apply those changes you mention, though - is it something in the router.php I have to adapt? Do you maybe have links to a good resource on how routing is supposed to be implemented in J4 components (or just a simple, working example - can't figure out how it's working in the included components with all the service stuff)?
    – codeling
    Oct 15, 2022 at 8:52
  • As it turns out, for me I think the error came from not clearing out the in/out $segments parameter in the router's parse method (solution to that inspired by another component). Maybe a joomla bug...
    – codeling
    Oct 15, 2022 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.