no message

This commit is contained in:
hellcat 2026-09-12 18:30:38 +08:00
parent 2ed3e5b808
commit 0792297bb8

View File

@ -8,19 +8,18 @@ class RobotsController extends Controller
{ {
public function index(): Response public function index(): Response
{ {
$sContent = implode("\n", [ $sContent = "User-agent: *\n";
'User-agent: *', $sContent .= "Allow: /\n";
'Allow: /', $sContent .= "Disallow: /admin/\n";
'Disallow: /admin/', $sContent .= "Disallow: /api/\n";
'Disallow: /api/', $sContent .= "Disallow: /storage/\n";
'Disallow: /storage/', $sContent .= "Disallow: /vendor/\n";
'Disallow: /vendor/', $sContent .= "Disallow: /test/\n";
'Disallow: /test/', $sContent .= "Disallow: /*?*\n\n";
'Disallow: /*?*', $sContent .= "Sitemap: " . config('app.url') . "/sitemap.xml\n";
'Sitemap: ' . config('app.url') . '/sitemap.xml',
]);
// 核心修复:强制指定 text/plain 响应头
return response($sContent, 200) return response($sContent, 200)
->header('Content-Type', 'text/plain'); ->header('Content-Type', 'text/plain; charset=utf-8');
} }
} }