use 302 redirects by default, explicitely specify 301 where really needed
This commit is contained in:
parent
8ea3807f4b
commit
34b7980587
@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
class RedirectResponse extends Response {
|
class RedirectResponse extends Response {
|
||||||
|
|
||||||
public function __construct(string $url) {
|
public function __construct(string $url, int $code = 302) {
|
||||||
parent::__construct(301);
|
parent::__construct($code);
|
||||||
$this->addHeader('HTTP/1.1 301 Moved Permanently');
|
|
||||||
$this->addHeader('Location: '.$url);
|
$this->addHeader('Location: '.$url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Auto extends RequestHandler {
|
|||||||
public function get(): Response {
|
public function get(): Response {
|
||||||
list($name) = $this->input('name');
|
list($name) = $this->input('name');
|
||||||
if ($name == 'coreboot-mba51-flashing')
|
if ($name == 'coreboot-mba51-flashing')
|
||||||
return new RedirectResponse('/coreboot-mba52-flashing/');
|
return new RedirectResponse('/coreboot-mba52-flashing/', 301);
|
||||||
|
|
||||||
if (is_numeric($name)) {
|
if (is_numeric($name)) {
|
||||||
$post = posts::get((int)$name);
|
$post = posts::get((int)$name);
|
||||||
|
@ -5,7 +5,7 @@ namespace handler\main;
|
|||||||
class ProjectsHtml extends \RequestHandler {
|
class ProjectsHtml extends \RequestHandler {
|
||||||
|
|
||||||
public function get(): \Response {
|
public function get(): \Response {
|
||||||
return new \RedirectResponse('/projects/');
|
return new \RedirectResponse('/projects/', 301);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -52,6 +52,4 @@ class admin {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user