Extend Action.redirect() (add new param "permanently" for set header 301 Moved permanently).

This commit is contained in:
Alexander Demidov
2013-09-23 17:22:35 +04:00
parent 9625b1e7a4
commit 0fc1884c93

View File

@ -39,9 +39,13 @@ abstract class Action
* Redirect
*
* @param mixed $url
* @param bool $permanently
*/
protected function redirect($url = null)
protected function redirect($url = null, $permanently = false)
{
if ($permanently) {
header('HTTP/1.1 301 Moved Permanently');
}
header('Location: ' . (($url) ? $url : Env::getRequestUri()));
exit();
}