I am creating a component but need to redirect all incoming requests to the new component. The URL looks like this currently: index.php?option=com_component&view=xxx and when this comes in I want to replace com_component into com_newcomponent, all internal views are the same.

Is this possible by a simple plugin?

 * Fucntionality which needs to be triggered on After the system has been loaded.
 * @since 1.0.0
public function onAfterInitialise()
    $app = JFactory::getApplication();

    // Frontend only, otherwise return.
        return false;

    $router = $app->getRouter();
    $callback = array($this, 'buildRoute');


public function buildRoute($router, $uri)
    $routerClone = clone $router;
    $vars= $routerClone->parse($uri);

    if($vars['option'] == 'com_component1' && $vars['view'] == 'update')
        $uri->setVar('option', 'com_component_new');

  • But this url is for the Joomla updater so it is not always a SEF URL. Does this still work then? – Robert Dam Jun 19 '17 at 12:59

You can use a simple system plugin, with the event onAfterInitilization() do some very basic checks, e.g. isAdmin, is the component com_component used and if so do the redirect there

  • I was writing this but the old url is being kept and viewed an I want to redirect it to the new space – Robert Dam Jun 19 '17 at 12:49
  • Found an answer in the yireo plugins book. Always useful a book from Jisse – Robert Dam Jul 7 '17 at 11:00

Your Answer

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

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