From 0fc1884c933be990fd04eea61ae8549599f6af95 Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Mon, 23 Sep 2013 17:22:35 +0400 Subject: [PATCH] Extend Action.redirect() (add new param "permanently" for set header 301 Moved permanently). --- app/Action.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Action.php b/app/Action.php index 1ad7056..36fd258 100644 --- a/app/Action.php +++ b/app/Action.php @@ -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(); }