robots.txt (#89)

Closes #89

I also added humans.txt just for fun
This commit is contained in:
Ilya Prokopenko 2021-12-27 19:35:14 +03:00
parent 1ba2786f8b
commit b32f366b01
No known key found for this signature in database
GPG key ID: 7736BBBB05F14A56
2 changed files with 38 additions and 0 deletions

View file

@ -83,4 +83,38 @@ final class AboutPresenter extends OpenVKPresenter
{
$this->template->languages = getLanguages();
}
function renderRobotsTxt(): void
{
$data = "# robots.txt file for openvk\n"
. "#\n"
. "# this includes only those links that are not in any way\n"
. "# covered from unauthorized persons (for example, due to\n"
. "# lack of rights to access the admin panel)\n\n"
. "User-Agent: *\n"
. "Disallow: /rpc\n"
. "Disallow: /language\n"
. "Disallow: /badbrowser.php\n"
. "Disallow: /logout\n"
. "Disallow: /away.php\n"
. "Disallow: /im?\n"
. "Disallow: *query=\n"
. "Disallow: *?lg=\n"
. "Disallow: *hash=\n"
. "Disallow: *?jReturnTo=\n"
. "Disallow: /wall*\n"
. "Disallow: /method/*\n"
. "Disallow: /token*";
header("Content-Type: text/plain");
exit($data);
}
function renderHumansTxt(): void
{
// :D
header("HTTP/1.1 302 Found");
header("Location: https://github.com/openvk/openvk#readme");
exit;
}
}

View file

@ -265,6 +265,10 @@ routes:
handler: "About->sandbox"
- url: "/internal/wall{num}"
handler: "Wall->wallEmbedded"
- url: "/robots.txt"
handler: "About->robotsTxt"
- url: "/humans.txt"
handler: "About->humansTxt"
- url: "/{?shortCode}"
handler: "UnknownTextRouteStrategy->delegate"
placeholders: