use 302 redirects by default, explicitely specify 301 where really needed

This commit is contained in:
Evgeny Zinoviev 2022-07-09 20:23:29 +03:00
parent 8ea3807f4b
commit 34b7980587
4 changed files with 4 additions and 7 deletions

View File

@ -2,9 +2,8 @@
class RedirectResponse extends Response {
public function __construct(string $url) {
parent::__construct(301);
$this->addHeader('HTTP/1.1 301 Moved Permanently');
public function __construct(string $url, int $code = 302) {
parent::__construct($code);
$this->addHeader('Location: '.$url);
}

View File

@ -17,7 +17,7 @@ class Auto extends RequestHandler {
public function get(): Response {
list($name) = $this->input('name');
if ($name == 'coreboot-mba51-flashing')
return new RedirectResponse('/coreboot-mba52-flashing/');
return new RedirectResponse('/coreboot-mba52-flashing/', 301);
if (is_numeric($name)) {
$post = posts::get((int)$name);

View File

@ -5,7 +5,7 @@ namespace handler\main;
class ProjectsHtml extends \RequestHandler {
public function get(): \Response {
return new \RedirectResponse('/projects/');
return new \RedirectResponse('/projects/', 301);
}
}

View File

@ -52,6 +52,4 @@ class admin {
]);
}
}