cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong image URLs in sitemap.xml

Wrong image URLs in sitemap.xml

Hey guys,

 

I got an issue with generating sitemap.xml in Magento CE 2.2.2

 

I just created 3 sitemaps, one for each store view (language). It worked out fine, except the image and thumbnail URLs. It looks like that:

https://mydomain.de/pub/media/https://mydomain.de/pub/media/catalog/product/cache/ce2c090f9c3d4f3597...

So I always get that https://mydomain.de/pub/media piece in front of the (well, at least a bit) right URL. I didn`t change base URL for media configurations.

 

Does anyone have an idea about what´s wrong?

4 REPLIES 4

Re: Wrong image URLs in sitemap.xml

Facing same issue in magento 2.3.0

Re: Wrong image URLs in sitemap.xml

Facing the same issue in Magento 2.3.4

Has anyone fixed it yet? Any suggestions?

Re: Wrong image URLs in sitemap.xml

I've just come across this on 2.3.5. I'll see what I can find

Re: Wrong image URLs in sitemap.xml

In Model/Sitemap.php, _getMediaUrl() method is used and generates a wrong image url.
This method is deprecated and should not be used anymore.
Instead of

htmlspecialchars($this->_getMediaUrl($image->getUrl()))


just use

htmlspecialchars($image->getUrl())

_isEnabledSubmissionRobots() and _addSitemapToRobotsTxt() methods are also deprecated and will be removed.

 

Hope it helps !
Problem Solved ? Click on 'Kudos' & Accept as Solution to encourage to write more answers !!
Thank you