Main language with prefix throws 404 on sitemap.xml URL

Created on 19 September 2023, over 1 year ago
Updated 23 September 2023, about 1 year ago

Problem/Motivation

Our website has "en" prefix enabled on our main language (English). Trying to access www.domain.tld/en/sitemap.xml throws a 404. only www.domain.tld/sitemap.xml works. Problem is, the module considers the "/en" prefixed URL to be the correct one when the sitemap is generated.

Steps to reproduce

  • Enable multilingual support
  • Add URL prefix to the main language of your website (ex: "en")
  • Add a "Default hreflang" sitemap and include all content types
  • Generate links
  • Try to open www.mydomain.tld/prefix/sitemap.xml
πŸ› Bug report
Status

Closed: works as designed

Version

4.0

Component

Code

Created by

πŸ‡«πŸ‡·France 0xl337

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @0xl337
  • πŸ‡ΊπŸ‡¦Ukraine gilmord πŸ‡ΊπŸ‡¦Ukraine

    Does it make any sense to implement this?

    Sitemap is basically used by bots and crawlers, which typically expect it to be located at /sitemap.xml and you have to point search engines manually if you have sitemap at any other location.

    You can check this issue β†’ and the related issues - it contains explanations why this module has the sitemap at /sitemap.xml

    If you really-really want it to be at /en - I can suggest that you create a URL alias for /en/sitemap.xml to be alias for /sitemap.xml, optionally you can block access to /sitemap.xml using nginx for example. But do not forget to point the search engines where to look for your sitemap.

    Also I do not think this is a bug or it is critical considering the attached Related issue explanations.

  • Status changed to Closed: works as designed about 1 year ago
  • πŸ‡©πŸ‡ͺGermany gbyte Berlin

    Thank you @gilmord, you are correct, this module generates multilingual sitemaps out of the box. Each sitemap is multilingual same as the default sitemap. That means your en variant also has links to all languages. Please don't use sitemap variants this way. They're there for structuring content in sitemap, not for defining languages. Please read about Google hreflang sitemaps.

Production build 0.71.5 2024