How to redirect using the Joomla! 1.5 and 2.5 API

Written by Ian Carnaghan · 17 sec read >

When developing a Joomla! Component or Module you can use the Joomla! API to redirect the user from one page to another

Joomla! 1.5 Example

global $mainframe;
$link = 'http://yourlink';
$msg = 'message'
$mainframe->redirect($link, $msg, $msgType='message');

Joomla! 2.5 Example

$app = JFactory::getApplication();
$link = 'http://yourlink';
$msg = 'message'
$app->redirect($link, $msg, $msgType='message',$moved=false);

Take note that $msgType can be either messagenotice or error

The API page can be accessed here for Joomla! 1.5 and here for Joomla! 2.5

Last Updated On March 25, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. Profile

Leave a Reply

Notify of