Add robots.txt

This commit is contained in:
Riyyi
2021-06-21 16:39:51 +02:00
parent aed4f15e22
commit b1072b360e
2 changed files with 16 additions and 1 deletions
+15 -1
View File
@@ -68,6 +68,20 @@ class IndexController extends PageController {
exit();
}
public function robotsAction(): void
{
$url = Config::c('APP_URL');
header('content-type: text/plain; charset=UTF-8');
echo <<< EOF
User-agent: *
Allow: /
Disallow: /admin
Sitemap: $url/sitemap.xml
EOF;
}
public function sitemapAction(): void
{
$xml = new \SimpleXMLElement('<urlset/>');
@@ -91,7 +105,7 @@ class IndexController extends PageController {
$url->addChild('loc', $loc);
}
Header('Content-type: text/xml');
header('content-type: text/xml; charset=UTF-8');
print($xml->asXML());
}
+1
View File
@@ -14,6 +14,7 @@ return [
// URL, controller, action, view/title/description
['/', 'IndexController', '', ''],
['/img/captcha.jpg', 'IndexController', 'captcha', ''],
['/robots.txt', 'IndexController', 'robots', ''],
['/sitemap.xml', 'IndexController', 'sitemap', ''],
['/login', 'LoginController', 'login', ['', 'Sign in', '']],
['/reset-password', 'LoginController', 'reset', ['', 'Reset password', '']],