| API | Package | Subpackage | Class | Method | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Application |
JApplication |
redirect |
redirect() |
Never | Work in Progress |
Redirects to another URL, optionally enqueueing a message in the system message queue (which will be displayed the next time a page is loaded) using the enqueueMessage method. If the headers have not been sent, the redirect will be accomplished using a ‘301 Moved Permanently’ code in the header pointing to a new location. If the headers have already been sent, this will be accomplished using a JavaScript statement. Redirect to another URL
void redirect ( $url, $msg, $msgType )
| $url | string | is a string containing the URL to which to redirect. |
| $msg | string | is a string containing a message to display on redirect (see enqueueMessage for more details). |
| $msgType | string | is a string containing the message type (see enqueueMessage for more details). |
Example
global $mainframe; $mainframe->enqueueMessage( 'The first message!' ); $mainframe->enqueueMessage( 'The second message!', 'alert' ); $mainframe->enqueueMessage( 'The third message!' ); $mainframe->redirect( JURI::base() . 'index.php?option=com_poll&redirected=1' );
might redirect the browser to http://127.0.0.1/administrator/index.php?option=com_poll&redirected=1.