How can I replicate the same thing in joomla 5?
I tried to create a custom plugin but I end up on the 404 page.
Code: Select all
<?php
defined('_JEXEC') or die;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Factory;
use Joomla\CMS\Uri\Uri;
class PlgSystemCustomRouter extends CMSPlugin
{
public function onAfterInitialise()
{
$app = Factory::getApplication();
if ($app->isClient('site'))
{
$input = $app->input;
$uri = Uri::getInstance();
$path = $uri->getPath();
if (preg_match('#^viaggi/(\d+)-([a-zA-Z0-9-]+)$#', $path)) {
$input->set('option', 'com_content');
$input->set('view', 'article');
$input->set('id', 2);
$input->set('Itemid', 104);
}
}
}
}