Joomla Router & SEF changes: Joomla 3 → 4, 5 and 6
16 issues in this guide
Routing and SEF break when extension routers still assume Joomla 3 includes and JRoute/JUri globals. This guide groups 16 entries: JApplicationWebRouterRest, JComponentRouterLegacy, JFactory::getUri(), JHelperRoute, class MyMenu extends JMenu, JMenu, JMenuItem, $item->params->get('show_title'), JPathway, JRoute, and 6 more. The replacement pattern is Route::_() / Uri::getInstance() from the CMS Router and Uri namespaces, menu params via getParams()/setParams(), and component routers built on RouterView + rules instead of legacy JComponentRouterLegacy subclasses or require JPATH_SITE.'/includes/router.php'. REST-style JApplicationWebRouter* classes are gone — rebuild on Joomla Web Services or the joomla/router package. Hop mix: 6 at Joomla 3 → 4; 10 at Joomla 5 → 6. Run a staging pass with SEF on and off so you catch both alias removals (J5→J6) and structural removals (J3→J4). Each entry below shows the concrete class or call to delete and what the catalog lists as the replacement. Catalog replacements in this guide include JApplicationWebRouterRest → joomla/router package; JComponentRouterLegacy → Joomla\CMS\Component\Router\RouterBase; JFactory::getUri() → Uri::getInstance(); JHelperRoute → Joomla\CMS\Helper\RouteHelper. Open each h2 anchor for the full before/after, fix list, and error strings shipped in the reference data.
JAPP-WEB-ROUTER-001
JApplicationWebRouterRest
JApplicationWebRouter*
The old web-app REST router classes were removed.
JApplicationWebRouterRest → joomla/router package
Dies at Joomla 3 → 4What you will see
- Class "JApplicationWebRouter" not found
- Class "JApplicationWebRouterRest" not found
Symptoms people search
custom REST router fatal
Replace this code
Swap JApplicationWebRouterRest for joomla/router package.
Joomla 3
Remove or stop calling this
$router = new JApplicationWebRouterRest($app);Joomla 4 / 6
Use this instead
Use Joomla\Router\Router from the router package / component RouterView.How to fix it
- 1Rebuild API routing on Joomla Web Services or joomla/router.
Also known as
JApplicationWebRouterBase · JApplicationWebRouterRest
There is no 1:1 swap for this one. The architecture changed. If you cannot rewrite it, Infyways can.
JCOMPONENTROUTER-CLASS-001
JComponentRouterLegacy
JComponentRouterLegacy class name
JComponentRouterLegacy is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JComponentRouterLegacy" not found.
JComponentRouterLegacy → Joomla\CMS\Component\Router\RouterBase
Dies at Joomla 5 → 6What you will see
- Class "JComponentRouterLegacy" not found
- Class 'JComponentRouterLegacy' not found
- Failed to open stream: JComponentRouterLegacy
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JComponentRouterLegacy for Joomla\CMS\Component\Router\RouterBase.
Joomla 3
Remove or stop calling this
JComponentRouterLegacy::getInstance();
// or new JComponentRouterLegacy()Joomla 4 / 6
Use this instead
use Joomla\CMS\Component\Router\RouterBase;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Component\Router\RouterBase.
- 2Replace every JComponentRouterLegacy with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JComponentRouterLegacy · Joomla\CMS\Component\Router\RouterBase · class alias · J prefix
JFACTORY-GETURI-001
JFactory::getUri()
Factory::getUri()
getUri() was removed from Factory in Joomla 4. Use the Uri class.
JFactory::getUri() → Uri::getInstance()
Dies at Joomla 3 → 4What you will see
- Call to undefined method Joomla\CMS\Factory::getUri
- Call to undefined method JFactory::getURI
Symptoms people search
canonical URL code fatals
Replace this code
Swap JFactory::getUri() for Uri::getInstance().
Joomla 3
Remove or stop calling this
$uri = JFactory::getURI();
echo $uri->toString();Joomla 4 / 6
Use this instead
use Joomla\CMS\Uri\Uri;
$uri = Uri::getInstance();How to fix it
- 1Replace Factory::getUri()/getURI() with Uri::getInstance().
Also known as
JFactory::getUri()
JHELPERROUTE-CLASS-001
JHelperRoute
JHelperRoute class name
JHelperRoute is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JHelperRoute" not found.
JHelperRoute → Joomla\CMS\Helper\RouteHelper
Dies at Joomla 5 → 6What you will see
- Class "JHelperRoute" not found
- Class 'JHelperRoute' not found
- Failed to open stream: JHelperRoute
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JHelperRoute for Joomla\CMS\Helper\RouteHelper.
Joomla 3
Remove or stop calling this
JHelperRoute::getInstance();
// or new JHelperRoute()Joomla 4 / 6
Use this instead
use Joomla\CMS\Helper\RouteHelper;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Helper\RouteHelper.
- 2Replace every JHelperRoute with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JHelperRoute · Joomla\CMS\Helper\RouteHelper · class alias · J prefix
JPATHWAY-CLASS-001
JPathway
JPathway class name
JPathway is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JPathway" not found.
JPathway → Joomla\CMS\Pathway\Pathway
Dies at Joomla 5 → 6What you will see
- Class "JPathway" not found
- Class 'JPathway' not found
- Failed to open stream: JPathway
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JPathway for Joomla\CMS\Pathway\Pathway.
Joomla 3
Remove or stop calling this
JPathway::getInstance();
// or new JPathway()Joomla 4 / 6
Use this instead
use Joomla\CMS\Pathway\Pathway;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Pathway\Pathway.
- 2Replace every JPathway with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JPathway · Joomla\CMS\Pathway\Pathway · class alias · J prefix
JROUTE-CLASS-001
JRoute
JRoute class name
JRoute is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JRoute" not found.
JRoute → Joomla\CMS\Router\Route
Dies at Joomla 5 → 6What you will see
- Class "JRoute" not found
- Class 'JRoute' not found
- Failed to open stream: JRoute
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JRoute for Joomla\CMS\Router\Route.
Joomla 3
Remove or stop calling this
JRoute::getInstance();
// or new JRoute()Joomla 4 / 6
Use this instead
use Joomla\CMS\Router\Route;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Router\Route.
- 2Replace every JRoute with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JRoute · Joomla\CMS\Router\Route · class alias · J prefix
JROUTER-CLASS-001
JRouter
JRouter class name
JRouter is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JRouter" not found.
JRouter → Joomla\CMS\Router\Router
Dies at Joomla 5 → 6What you will see
- Class "JRouter" not found
- Class 'JRouter' not found
- Failed to open stream: JRouter
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JRouter for Joomla\CMS\Router\Router.
Joomla 3
Remove or stop calling this
JRouter::getInstance();
// or new JRouter()Joomla 4 / 6
Use this instead
use Joomla\CMS\Router\Router;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Router\Router.
- 2Replace every JRouter with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JRouter · Joomla\CMS\Router\Router · class alias · J prefix
JROUTER-GETINSTANCE-001
require JPATH_SITE . '/includes/router.php'
JRouter::getInstance() + includes/router.php
Manually including includes/router.php is gone. The router is on the application.
require JPATH_SITE . '/includes/router.php' → Autoloaded Router class
Dies at Joomla 3 → 4What you will see
- Failed opening required 'includes/router.php'
- Call to undefined method JRouter::getInstance
Symptoms people search
SEF router include fatal
Replace this code
Swap require JPATH_SITE . '/includes/router.php' for Autoloaded Router class.
Joomla 3
Remove or stop calling this
require_once JPATH_SITE . '/includes/router.php';
$router = JRouter::getInstance('site');Joomla 4 / 6
Use this instead
$router = Factory::getApplication()->getRouter();How to fix it
- 1Delete the require.
- 2Use $app->getRouter().
Also known as
includes/router.php · JRouter::getInstance
JROUTERADMIN-CLASS-001
JRouterAdministrator
JRouterAdministrator class name
JRouterAdministrator is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JRouterAdministrator" not found.
JRouterAdministrator → Joomla\CMS\Router\AdministratorRouter
Dies at Joomla 5 → 6What you will see
- Class "JRouterAdministrator" not found
- Class 'JRouterAdministrator' not found
- Failed to open stream: JRouterAdministrator
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JRouterAdministrator for Joomla\CMS\Router\AdministratorRouter.
Joomla 3
Remove or stop calling this
JRouterAdministrator::getInstance();
// or new JRouterAdministrator()Joomla 4 / 6
Use this instead
use Joomla\CMS\Router\AdministratorRouter;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Router\AdministratorRouter.
- 2Replace every JRouterAdministrator with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JRouterAdministrator · Joomla\CMS\Router\AdministratorRouter · class alias · J prefix
JROUTERSITE-CLASS-001
JRouterSite
JRouterSite class name
JRouterSite is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JRouterSite" not found.
JRouterSite → Joomla\CMS\Router\SiteRouter
Dies at Joomla 5 → 6What you will see
- Class "JRouterSite" not found
- Class 'JRouterSite' not found
- Failed to open stream: JRouterSite
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JRouterSite for Joomla\CMS\Router\SiteRouter.
Joomla 3
Remove or stop calling this
JRouterSite::getInstance();
// or new JRouterSite()Joomla 4 / 6
Use this instead
use Joomla\CMS\Router\SiteRouter;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Router\SiteRouter.
- 2Replace every JRouterSite with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JRouterSite · Joomla\CMS\Router\SiteRouter · class alias · J prefix
JURI-CLASS-001
JUri
JUri class name
JUri is a Joomla 3 global class. Joomla 4 still has an alias. Joomla 5 needs the Behaviour – Backward Compatibility plugin. Native Joomla 6 does not load that alias — you get Class "JUri" not found.
JUri → Joomla\CMS\Uri\Uri
Dies at Joomla 5 → 6What you will see
- Class "JUri" not found
- Class 'JUri' not found
- Failed to open stream: JUri
Symptoms people search
white screen after disabling compatibility plugin · class not found on Joomla 6 · works on Joomla 5 until I turn off backward compatibility
Replace this code
Swap JUri for Joomla\CMS\Uri\Uri.
Joomla 3
Remove or stop calling this
JUri::getInstance();
// or new JUri()Joomla 4 / 6
Use this instead
use Joomla\CMS\Uri\Uri;
// Call the namespaced class. Do not keep the J prefix.How to fix it
- 1Add a use statement for Joomla\CMS\Uri\Uri.
- 2Replace every JUri with the short class name from that use line.
- 3Disable Behaviour – Backward Compatibility on a Joomla 5 staging site. If it fatals, this class is still in the code.
Also known as
JUri · Joomla\CMS\Uri\Uri · class alias · J prefix
SEF-ROUTER-001
Joomla 3 router + system SEF plugin hacks
index.php?option= SEF assumptions / plg_system_sef
Joomla 4 rebuilt SEF. Plugins that rewrite query strings the J3 way break menus, multilingual, and API routes.
Joomla 3 router + system SEF plugin hacks → Component RouterView + rules
Dies at Joomla 3 → 4Symptoms people search
404 after upgrade · SEF urls broken · index.php? still showing
Replace this code
Swap Joomla 3 router + system SEF plugin hacks for Component RouterView + rules.
Joomla 3
Remove or stop calling this
// Parse $_SERVER['REQUEST_URI'] by exploding index.php?option=com_lms&view=course&id=Joomla 4 / 6
Use this instead
Implement RouterView / RouterViewConfiguration for com_lms. Do not str_replace on index.php? in a system plugin.How to fix it
- 1Write a component router.
- 2Retest menu items and language associations.
Also known as
plg_system_sef · RouterView · SEF 404
There is no 1:1 swap for this one. The architecture changed. If you cannot rewrite it, Infyways can.