read sitemap location in user-agent:* only

This commit is contained in:
ghost 2023-07-29 23:37:25 +03:00
parent 051bfb2e81
commit a5a48f37f7

View File

@ -16,6 +16,12 @@ class Robots {
$row = strtolower(trim($row)); $row = strtolower(trim($row));
// User-agent * begin
if (preg_match('!^user-agent:\s?\*!', $row)) {
$read = true;
continue;
}
// Parse sitemap address // Parse sitemap address
if (preg_match('!^sitemap:\s?(.*)!', $row, $matches)) { 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) { if ($read) {
$part = explode(' ', $row); $part = explode(' ', $row);