Browse Source

read sitemap location in user-agent:* only

main
ghost 1 year ago
parent
commit
a5a48f37f7
  1. 12
      library/robots.php

12
library/robots.php

@ -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);

Loading…
Cancel
Save