Sitemap
Module: Magenx_Sitemap · no GraphQL changes
Magento’s sitemap lists its own theme’s URLs, such as men/tops/blue-jacket.html. The storefront serves different ones, such as /en/product/blue-jacket. Without this module every sitemap URL is a 404. This module rewrites the URLs while Magento generates the sitemap.
| Magento writes | The storefront serves |
|---|---|
men/tops.html | /en/category/men/tops |
men/tops/blue-jacket.html | /en/product/blue-jacket |
about-us | /en/about-us |
| home page | /en |
How URLs are rewritten
Section titled “How URLs are rewritten”For each product, category and CMS page:
- The
.htmlsuffix is removed. - A product keeps only its URL key, without the category path.
- The type prefix is added:
product,category, or nothing for CMS pages. - The store view’s locale prefix is added, for example
en. - The home page becomes the store root:
/en, never/en/home.
Settings are per store view, so each locale gets its own prefix.
Set up
Section titled “Set up”- Install the module. It ships switched off.
- For each store view, go to Stores > Configuration > Magenx > Sitemap URLs, set Store Path Prefix to the storefront locale, and set Rewrite Sitemap URLs to Yes.
- In Marketing > SEO & Search > Site Map, add one sitemap per store view, each with its own file name.
- Generate them, then check that one product, one category, one CMS page and the home page each open on the storefront.

Limits:
- Magento’s optional batch sitemap generation is not covered: its product URLs are not rewritten. The admin button and the standard
sitemap_generatecron job are covered. - Product image URLs keep Magento’s media URL.
- If
robots.txtpoints at a single/sitemap.xml, make that file a sitemap index of the per-store-view sitemaps.
User flows
Section titled “User flows”Configure
- The admin switches rewriting on for the German store view and sets the store prefix "de".
- Entity prefixes keep their defaults.
Generate
- The admin (or the schedule) generates the German sitemap.
- Entries are rewritten:
herren/oberteile.html→de/category/herren/oberteile;herren/oberteile/blaue-jacke.html→de/product/blaue-jacke;ueber-uns→de/ueber-uns; home →de. - The host part still comes from the store's base address.
Verify
- One product, one category, one content page and the home entry each open on the storefront.
These always hold:
- With rewriting off, the sitemap is unchanged.
- Rewriting never changes stored URLs or catalog data.
- One store view's settings never affect another store view's sitemap.
- Product =
[store]/[product prefix]/[product key]. - Category =
[store]/[category prefix]/[path without suffix]. - Content page =
[store]/[page prefix]/[identifier]; home =[store].
Edge cases
Section titled “Edge cases”| Situation | What happens |
|---|---|
| Rewriting on, store prefix empty. | No store segment; no leading double slash. |
| No catalog suffix configured. | Nothing removed. |
| Product path without category. | de/product/<key>. |
| Entry already absolute. | Unchanged. |
| Home page identifier "home". | de, never de/home. |
| Path ending in the suffix twice. | Only the final suffix removed. |
Who it applies to
Section titled “Who it applies to”- Store views with rewriting on; standard generation.
Out of scope
Section titled “Out of scope”- Generating the sitemap or sitemap index (existing generation does that).
- Changing image addresses.
- Optimised bulk generation modes that bypass normal item collection.
- Adding storefront-only pages (blog, deals).
- Serving the file from the storefront (deployment).
Install
Section titled “Install”composer require magenxcommerce/module-sitemapbin/magento module:enable Magenx_Sitemapbin/magento setup:upgradebin/magento setup:di:compile # production mode onlybin/magento cache:flush- PHP
~8.4.0||~8.5.0, Magento 2.4.8.
Configuration
Section titled “Configuration”Stores > Configuration > Magenx > Sitemap URLs
General
| Setting | Default | Scope | Notes |
|---|---|---|---|
Rewrite Sitemap URLsmagenx_sitemap/ | No | Store view | Yes/No. Rewrites every URL in the generated XML sitemap into the headless storefront's route shape. Off means Magento's own paths are written unchanged. |
Store Path Prefixmagenx_sitemap/ | empty | Store view | Text. Shown when Rewrite Sitemap URLs = Yes. Leading path segment for this store view, normally the storefront locale (for example "en" for https://example.com/en/product/blue-jacket). Set it per store view; leave empty for a store served at the site root. |
Strip URL Suffixmagenx_sitemap/ | Yes | Store view | Yes/No. Shown when Rewrite Sitemap URLs = Yes. Removes the catalog URL suffix (Catalog > SEO, usually ".html") from product and category URLs, which the storefront routes do not use. |
Categories
| Setting | Default | Scope | Notes |
|---|---|---|---|
Category Path Prefixmagenx_sitemap/ | category | Store view | Text. Shown when enabled = Yes. Inserted between the store path prefix and the category URL path, producing /{store prefix}/{prefix}/men/tops. Leave empty to keep the bare category path. |
Products
| Setting | Default | Scope | Notes |
|---|---|---|---|
Product Path Prefixmagenx_sitemap/ | product | Store view | Text. Shown when enabled = Yes. Inserted between the store path prefix and the product URL, producing /{store prefix}/{prefix}/blue-jacket. Leave empty to keep the bare product path. |
Use Product URL Key Onlymagenx_sitemap/ | Yes | Store view | Yes/No. Shown when enabled = Yes. Drops any category path from the product URL (men/tops/blue-jacket becomes blue-jacket). Required when "Use Categories Path for Product URLs" is enabled, because the storefront product route is a single segment. |
CMS Pages
| Setting | Default | Scope | Notes |
|---|---|---|---|
CMS Page Path Prefixmagenx_sitemap/ | empty | Store view | Text. Shown when enabled = Yes. Inserted between the store path prefix and the CMS page identifier. Leave empty for storefronts that serve CMS pages at /{store prefix}/{identifier}. The configured home page always collapses to the store root. |
Admin permissions
Section titled “Admin permissions”Grant these under System > Permissions > User Roles > Role Resources:
| Resource | Under | ID |
|---|---|---|
| Sitemap URLs Configuration | Stores > Settings > Configuration | Magenx_Sitemap::config |
Glossary
Section titled “Glossary”| Term | Meaning |
|---|---|
| Sitemap entry | One address the sitemap lists. |
| Store prefix | Leading path segment for a store view, usually its locale ("en"). |
| Entity prefix | Segment before product ("product"), category ("category") or content page addresses. |
| Suffix | Legacy file suffix on catalog addresses, e.g. ".html". |
| Product key | Last path segment of a product address. |
| Home page | The content page configured as the store's home. |