From a5a48f37f77424168c95d4ae0ebf436a37fe0187 Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 29 Jul 2023 23:37:25 +0300 Subject: [PATCH] read sitemap location in user-agent:* only --- library/robots.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/robots.php b/library/robots.php index 3cbf198..a92b8b6 100644 --- a/library/robots.php +++ b/library/robots.php @@ -16,6 +16,12 @@ class Robots { $row = strtolower(trim($row)); + // User-agent * begin + if (preg_match('!^user-agent:\s?\*!', $row)) { + $read = true; + continue; + } + // Parse sitemap address if (preg_match('!^sitemap:\s?(.*)!', $row, $matches)) { @@ -25,12 +31,6 @@ class Robots { } } - // User-agent * begin - if (preg_match('!^user-agent:\s?\*!', $row)) { - $read = true; - continue; - } - if ($read) { $part = explode(' ', $row);