How to redirect using the Joomla! 1.5 and 2.5 API

H

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

About the author

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.

About Author

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.

Follow Me