robots.txtの追加

This commit is contained in:
2026-03-19 04:24:24 +09:00
parent a1bd29cff6
commit 119f9f48b6
2 changed files with 10 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ if (DEBUG_MODE) {
include(ROOT.'/util.php');
$routes = [
Route::add('GET', 'robots.txt', Home::class.'@robots'),
Route::add('GET', 'blog/{page}', Home::class.'@article'),
Route::add('GET', 'about', Page::class.'@about'),
Route::add('GET', 'monero', Page::class.'@monero'),

View File

@@ -157,6 +157,15 @@ denyaccess:
}
}
public function robots(array $params): void {
$txt = "User-Agent: *\nDisallow: /login/\nDisallow: /register/";
$tmpFile = tempnam(sys_get_temp_dir(), 'tmpl_');
file_put_contents($tmpFile, $txt);
include $tmpFile;
unlink($tmpFile);
}
//------------------------------------------
// 機能性
//------------------------------------------