Browse Source

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

namespace
Alexander Demidov 11 years ago
parent
commit
0fc1884c93
  1. 6
      app/Action.php

6
app/Action.php

@ -39,9 +39,13 @@ abstract class Action
* Redirect * Redirect
* *
* @param mixed $url * @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())); header('Location: ' . (($url) ? $url : Env::getRequestUri()));
exit(); exit();
} }

Loading…
Cancel
Save