Fix replacement of sitemap entry in robot.txt

This commit is contained in:
Laurent Destailleur 2021-04-27 11:29:47 +02:00
parent 0d391ec185
commit 071fe087fd

View File

@ -2414,7 +2414,7 @@ if ($action == 'generatesitemaps' && $usercanedit) {
$robotsitemap = "Sitemap: ".$domainname."/".$xmlname;
$result = strpos($robotcontent, 'Sitemap: ');
if ($result) {
$result = preg_replace("/Sitemap.*\n/", $robotsitemap, $robotcontent);
$result = preg_replace('/Sitemap:.*/', $robotsitemap, $robotcontent);
$robotcontent = $result ? $result : $robotcontent;
} else {
$robotcontent .= $robotsitemap."\n";