How to fix 404 errors on Magento

On Magento, 404s usually come from disabled or deleted products, changed category structures, url_key edits, or migrating from Magento 1. Magento 2 has a built-in URL Rewrites tool for 301 redirects — here's how to use it and how to catch the URLs you miss.

Why 404 errors happen on Magento

  • A product or category was disabled or deleted while old links still point to it.
  • A product or category url_key (URL slug) was changed without a permanent redirect.
  • You migrated from Magento 1 (or another platform) and the old URL structure changed.
  • Old indexed URLs, .html suffixes, or external links reference paths that no longer resolve.

How to fix 404 errors on Magento, step by step

  1. 1

    Open URL Rewrites

    In the Magento 2 admin, go to Marketing → SEO & Search → URL Rewrites.

  2. 2

    Add a redirect

    Click 'Add URL Rewrite', choose the store, set Request Path to the old broken path and Target Path to the live page, and set Redirect Type to 'Permanent (301)'. Save.

  3. 3

    Enable auto-redirects for url_key changes

    Under Stores → Configuration → Catalog → Catalog → Search Engine Optimization, set 'Create Permanent Redirect for URLs if URL Key Changed' to Yes, so Magento auto-creates a 301 whenever you rename a product or category.

  4. 4

    Test

    Visit the old URL and confirm it 301-redirects to the correct page. Magento 301s pass SEO ranking to the destination.

Automatically rescue every 404 on Magento

Manually finding every broken URL across a large catalog is impractical. Redirect Mapper's snippet on your Magento 404 page (CMS/theme) detects 404s in real time and redirects shoppers to the closest live product or category automatically, logging each broken URL so you can add permanent Magento URL Rewrites later.

Frequently asked questions

They live under Marketing → SEO & Search → URL Rewrites. You add a URL Rewrite with a Request Path (old), Target Path (new), and Redirect Type set to Permanent (301).

Related guides