diff --git a/src/SitemapGenerator.php b/src/SitemapGenerator.php index 3de1b1d..0c4bd08 100644 --- a/src/SitemapGenerator.php +++ b/src/SitemapGenerator.php @@ -435,7 +435,9 @@ public function addURL( $this->writeSitemapStart(); } - $this->writeSitemapUrl($this->baseURL . $path, $lastModified, $changeFrequency, $priority, $alternates, $extensions); + $link = preg_match('/^https?:\/\//i', trim($path)) ? $path : $this->baseURL . $path; + + $this->writeSitemapUrl($link, $lastModified, $changeFrequency, $priority, $alternates, $extensions); if ($this->totalURLCount % 1000 === 0 || $this->sitemapURLCount >= $this->maxURLsPerSitemap) { $this->flushWriter();