Magento Open Source URL rewrites and 301 redirects

Magento Open Source URL rewrites and 301 redirects keep old product and category URLs working after renames, retirements and migrations. This page covers how to plan them and keep the rewrite table under control on large catalogs.

On this page

When Magento Open Source URL rewrites and 301 redirects become necessary

URL rewrites map a request for one address to the page that serves it, and a 301 redirect tells browsers and search engines that a page has permanently moved to a new address. In Magento Open Source you need them whenever an address that people, bookmarks, or links already use stops pointing at a live page: a renamed product, a retired category, a restructured catalog, or a move to a new domain. Without them, those old addresses return errors and visitors and inbound links land on dead ends.

Magento generates rewrites automatically. When a product or category is saved with a URL key, the platform writes entries into the URL rewrite table for its current address, and it can also create a redirect from the previous address when the URL key changes and the save option for permanent redirects is selected. Custom redirects are different: they are entries you add by hand in the admin, or in bulk through the rewrite tool, for cases the automatic process does not cover, such as a retired category with no replacement, a legacy path from a previous platform, or a mapping from an old site structure to a new one. Confirm in your installed version which save options and admin screens exist, because these details change between releases.

Treat rewrites as a planning decision made before launch, not a cleanup task after go-live. The URL formats, category paths, and suffixes you choose determine how many rewrites exist and how many must be mapped later, and every change to a URL key after launch creates another entry to track. Agree the old-to-new mapping, the ownership of each redirect, and the test plan with the people who own SEO and migration before the catalog is loaded. Expect the mapping work to be the largest part of the effort, not the import itself.

Which redirect approach fits each change

This table compares the four ways to create redirects on a Magento Open Source store, with the change each one fits, its ongoing upkeep and the failure modes to check. Read each row against the change you are making, then confirm the behavior in your own staging store before you rely on it.

ApproachWhen it fitsUpkeep after launchWhat can go wrong
Automatic rewrites after a URL key changeA product or category is renamed and the URL key is updated in the admin with the save-rewrite option selectedLow for single edits, but every generated rewrite stays in the table until someone removes itOld rewrites pile up over time, and a second rename can create a chain of redirects
Individual custom 301 redirects in the adminA small number of retired pages or one-off URLs that need a specific targetManual review of each entry, so it stays manageable only while the list is shortTypos in request paths or targets go unnoticed, and an entry can conflict with a category path rewrite
Bulk import of redirect mappingsA migration or a large catalog cleanup where you already hold a reviewed old-to-new URL mapRecurring when new mappings arrive, plus periodic checks that the table has not grown with stale rowsMappings that point to URLs which themselves redirect form chains, and unreviewed spreadsheets can overwrite existing rules
Server-level redirects at the web server or CDNRedirects for paths outside the store, such as legacy file paths, or redirects that must run before Magento handles the requestMaintained in web server or CDN configuration, so changes need the same review as code releasesRules can bypass store-level logic, and they are hard to see from the admin when a store view or host name changes
Category path conflictsProducts move between categories or category paths change, which can create extra URL variantsCheck after each category restructure, since rewrites depend on the category treeOld category-path URLs may still resolve, leading to duplicate content signals unless they redirect to the new path
Redirect chainsAny change made on top of an earlier change, such as a second rename or a migration after a prior redirectTrace each old URL to its final destination during every review cycleEach extra hop adds latency and dilutes the signal that search engines receive, so map every old URL directly to its final target

How to plan and load redirects before a URL change goes live

This sequence turns a list of changing URLs into a tested set of 301 redirects and retired pages that is live on launch day, with a monitoring plan for the 404s that remain.

  1. Export current URLs and traffic data

    The SEO or merchandising lead exports every indexable URL the store serves today, covering products, categories, CMS pages and any custom landing pages. Pull the Magento URL rewrite table from the admin or database, then join it with organic landing-page data from your analytics tool and the search console for the same period. Confirm the export includes every store view and website, because each one can carry its own rewrites. The step is done when you have one file with each old URL, its traffic and its current status code.

  2. Build the old-to-new URL mapping

    Map every old URL to its new destination in a single spreadsheet, with one row per old URL and one target per row. For renamed products and moved categories, the target is the new canonical URL, not a category page chosen for convenience. Check the mapping for duplicates, where two old URLs point to the same target, and for targets that do not exist yet. The step is done when every row has a target or a retirement decision and a reviewer has signed off the mapping.

  3. Decide permanent redirects and retired URLs

    Mark each row as a permanent 301 redirect or as a retired URL. Use a 301 when a product or category has a clear replacement that shoppers would expect to find. Retire URLs with no replacement, and decide deliberately whether they return a 404 or a 410 status, and whether the category page or the home page should receive them. Avoid sending large numbers of unrelated URLs to the home page. The step is done when every high-traffic URL has a documented decision and the rule for retired URLs is written down.

  4. Load redirects in staging and check the rewrite table

    Load the mapping into a staging store using the URL rewrite grid in the Magento admin under Marketing, SEO and Search, or through the import route your installed version documents. Confirm the redirect type, the request path, the target path and the store view for each row. Check the rewrite table for redirect chains, where an old URL points to an intermediate URL that itself redirects, and for loops, where two rows send each other back. The step is done when a query or export of the rewrite table shows one hop per redirect and no loops.

  5. Test redirects and targets with a crawl

    Run a crawler against staging using the full old URL list as input, and record the status code, the number of hops and the final URL for each row. Confirm that every redirected URL reaches a final target that returns 200, that no redirect ends at a 404, and that no redirect chain or loop remains. Spot-check a sample of retired URLs against the status code you chose. Confirm that canonical tags on the new targets point to themselves, so the new URLs are not diluted by the old ones. The step is done when the crawl report has zero loops, zero chains and zero unexpected 404s.

  6. Go live with redirects and confirm the cache is clear

    Import the approved redirect set into production during the agreed change window, then flush the full-page cache and any reverse proxy cache so the new rules are served. If Varnish is in front of the store, confirm the purge reaches it, since cached old responses can keep serving until cleared. Repeat a short crawl of production using the same URL list and compare the results with the staging report. The step is done when production matches staging for status codes and final URLs.

  7. Monitor 404s and redirect hits after launch

    Review the server access logs and the store's 404 reports on a fixed schedule after launch, and compare them with the old URL list. Add a redirect for any legitimate old URL that still returns a 404, and check whether any new URL is returning an error. Watch the search console for crawl errors and for old URLs still listed in the index. Keep the rewrite table under review, since every redirect adds a row, and remove rows for URLs that no longer receive traffic or links. The step is done when the 404 backlog is cleared and the post-launch review is recorded.

Keeping the rewrite table under control on large catalogs

The fastest way to bloat the rewrite table is to change URL keys casually. Every product or category URL key change makes Magento generate a new rewrite and, unless the old path is handled, leaves the previous path dead. Treat URL keys as a managed setting: agree a naming standard before launch, restrict who can edit URL keys in the admin, and require a redirect plan for any change to a live key. Mass edits through imports or the admin grid are the usual source of unplanned churn, so review the rewrite output after each batch rather than assuming the import was clean. Confirm with your team how your current build generates rewrites when a category moves, since category path changes multiply the number of product URLs affected.

Custom redirects you add by hand or through bulk import accumulate quietly. Set a review schedule, and for each custom redirect record why it exists, its target and its creation date. Consolidate chains into single hops: if A redirects to B and B later redirects to C, point A straight to C, because each extra hop adds latency and dilutes the signal passed to the final page. Review generated rewrites after every category restructure, since a moved parent can leave stale child paths that need one consolidated redirect instead of many.

Keeping old redirects forever is safe but grows the table and makes later audits harder. Pruning reduces clutter but can break inbound links and bookmarks that still send visitors to a retired URL. The decision therefore needs evidence: before removing a redirect, check the server and analytics logs for recent hits and review backlink data from your SEO tools for external links pointing at the old path. A redirect with no traffic and no backlinks is a candidate for removal, while one with active links should stay or be re-pointed to the current equivalent. Ask your partner or internal team to document this review process and the owner who signs off on each removal.

What breaks when redirects are planned poorly

Most redirect problems on a Magento Open Source store do not show up on launch day. They build up as rules are added, categories move and imports overwrite data, and they tend to hurt rankings and conversions quietly. Each card below names one failure and the check that catches it before customers or search engines do.

Redirect chains and loops

A chain forms when a URL redirects to a second URL that redirects again, often after a product is renamed twice. Each hop slows the visit and dilutes the signal passed to the final page, and a loop stops the page from loading at all. Crawl the old URL list with a tool that follows redirects, and fail the check on any path longer than one hop or any loop.

Redirects to pages that are removed

A 301 pointing at a product that is later disabled, noindexed or deleted sends search engines into a dead end. Redirect targets should be live, indexable pages with a clear purpose. Before launch, confirm that every target returns a 200 status, is not set to noindex, and is included in the sitemap for its store view.

Duplicate rewrites from category paths

When category paths are enabled in product URLs, one product can be reachable under several addresses, and each change to a category name can create a new rewrite. Old and new paths may both resolve, which splits signals across duplicates. Review the url_rewrite table for multiple active rows per product and confirm that canonical tags point to a single address.

Missed URLs from filtered navigation and search

Layered navigation and internal search generate URLs that rarely appear in a planned redirect map, yet they may have been linked or indexed. When a category is retired, its filtered variants can return errors instead of reaching a relevant page. Pull parameterized URLs from server logs and search console data, then decide for each whether to redirect, block or let it lapse.

Redirects lost during a replatform

A replatform often leaves the old platform's redirect rules behind because they live in a server file, a plugin or a spreadsheet that nobody migrated. Traffic to legacy URLs then lands on 404 pages for weeks. Inventory every source of old URLs before cutover, and after launch crawl the full legacy list and confirm each one returns a single 301 to the mapped target.

Rewrites lost after a migration import

A product or category import can regenerate or delete URL rewrites, especially when url keys change in the import file. Custom 301 rules created by hand may disappear without warning. Ask your implementation team to document whether the import regenerates rewrites, export the rewrite table before and after each import, and diff the two.

How a request to a retired URL is resolved

The request starts in the browser and first reaches the web server or CDN, which may hold a server-level redirect rule that answers before Magento runs. If nothing matches there, the request reaches Magento, where the URL rewrite table decides between a 301 to the new URL and a 404. A full-page cache such as Varnish can sit in front of this chain and serve a stored response, so a rewrite change may appear late or not at all until the cache is cleared. Check each layer in order when a redirect misbehaves.

Order of checks for a retired URL across server, cache and Magento layers.

Security and operational considerations for redirect rules

Redirect rules sit in the request path of every visitor and can send users anywhere the rule allows. The cards below cover the controls that keep those rules safe to edit, traceable after a change and consistent with the cache in front of the store.

Open redirect risk from user-supplied targets

A redirect whose target comes from a query parameter, a form field or an imported file can send shoppers to a domain you do not control, which is a common phishing pattern. Review every redirect rule, custom route or extension that reads a target from request input, and confirm that targets are limited to paths on your own store domains. Test with a crafted external URL on each path type you use.

Restricting who can edit redirects

URL rewrite editing is an admin function, so anyone with rights to change it can alter where live traffic and search engines land. Check which admin roles can open the URL rewrite screen and the rewrite import, and remove those permissions from roles that do not manage content or SEO. Confirm that admin accounts require individual logins and two-factor authentication, not shared credentials.

Change logging for rewrite edits

Magento Open Source does not give you a built-in audit trail of who changed a redirect and when, so plan where that record will come from. Options include exporting the rewrite table on a schedule, logging admin actions at the web server or SIEM layer, and recording change tickets against each import file. Confirm that you can answer who changed a given redirect and what it pointed to before the change.

Backups before bulk imports

A bulk import of redirects can replace or add many rows in the rewrite table at once, and reversing it by hand is slow. Take a database backup and export the current rewrite table before every import, and keep the import file under version control. Restore the backup in a staging copy to confirm that a rollback works before you rely on it in production.

Cache invalidation behind full-page cache

When Varnish is the full-page cache, a redirect change in the database will not reach visitors until the cached responses for the affected URLs are cleared. Adobe documents Varnish as the full-page cache accelerator for self-managed installations, so add a cache flush or targeted purge step to every redirect release. Test the old URL from outside your network after the change to confirm the new response is served.

Varnish cache docs

Checking redirect chains after each release

Stacked redirects, where one rule points to a URL that redirects again, slow pages and can cause search engines to drop long chains. Each release should include a crawl or scripted check of the redirect map that confirms each legacy URL reaches its final target in a single hop. Record the check results with the change ticket so that later releases can be compared against them.

Questions buyers ask before outsourcing redirect work

How much effort does a redirect map take for a Magento store?

The effort is set mainly by how many old URLs need a destination, how clean the source data is, and how many platforms or sites feed into the map. A store with a stable catalog and a short list of renamed categories is a small mapping job. A store moving products from several legacy sources, with duplicate slugs and years of retired SKUs, is a much larger one, because each old URL needs a reviewed target. Ask for a written mapping scope that states the URL count, the number of source systems and the rule for handling URLs with no clear replacement.

Can our internal team build the redirect map and the rewrites themselves?

Yes, many teams do, and Magento Open Source provides the URL rewrite functionality in the admin for managing individual and bulk redirects. The questions to settle are capacity and skill. Someone has to own the mapping logic, export and clean the old URL list, load redirects without creating chains or loops, and check the result against a crawl. If that person also owns the release calendar and the storefront theme, the work often competes with other priorities. A partner is most useful where the team lacks that time or has not done a migration of this size before.

What do we need to provide before redirect work can start?

The work depends on three inputs: an export of organic traffic and landing pages from your analytics or search console, a complete list of old URLs from the current site or a crawl, and access to a staging copy of the new store where rewrites can be tested. Add the new URL structure, any category path decisions and the names of the people who approve destination choices. Missing traffic data usually means the mapping prioritizes pages by guesswork, so confirm early which exports you can produce and in what format.

How long does testing and monitoring need to run after launch?

The monitoring window depends on your change calendar, not on a fixed period. Redirects should be tested on staging before launch, then checked again on production immediately after the cutover. After that, the team needs time to review crawl errors, 404 logs and search console reports across the period when search engines re-crawl the site. Plan for that review in the release calendar, and agree who fixes a missed redirect and how quickly. Freezing other large catalog changes during this window keeps the signal clean.

What drives the cost, and what should a written quote include?

Cost follows the scope: the number of URLs to map, the number of source systems, the amount of manual review for ambiguous pages, the size of the staging and testing work, and the post-launch monitoring period. One-time costs cover mapping, loading and testing. Recurring costs appear only if you buy a retainer for ongoing monitoring or later catalog changes. A useful quote lists the URL count or the method for counting it, the deliverables (redirect file, test report, crawl results), the responsibilities for each side, and the monitoring period in writing. DeployOpen does not publish a price list, and quotes follow from the written scope.

Is it safe to remove old redirects after a while?

Removing old redirects is safe only after you confirm that no meaningful traffic, backlinks or internal links still point to the old URLs. Check the analytics and server logs for hits on the old paths, and review the search console for any remaining reports of the old URLs. Keep rewrites that still receive requests, and remove the rest in batches so you can see the effect. Also check the rewrite table size: large catalogs accumulate stale entries, and cleanup should be a planned task with a backup taken first.

Which parts of the work carry the most risk if they go wrong?

The main risks are redirect chains and loops, redirects that point to pages that no longer exist, and old URLs that were never mapped and now return errors. Chains slow crawling and dilute link value, while loops can make pages unreachable. A rewrite table that grows without cleanup can also slow admin operations on large catalogs. Mitigate these with a single hop from each old URL to its final destination, a test pass that follows every mapped URL, and a post-launch review of 404 responses.

When a partner adds value and when an internal team can handle it

The decision turns on four things: how many URLs change, how complex the source platform's URL history is, how familiar your team is with the Magento admin and your web server, and who will watch the redirects after launch. A store with a few hundred products and categories and a single URL pattern can usually be handled by an internal team that knows the admin. A catalog with tens of thousands of renamed products, layered category paths, and years of parameterized URLs is where a partner's experience with bulk rewrite imports and rewrite table review earns its cost. Ask any bidder to state the URL count and the source URL patterns in writing before they quote.

Complexity sits mostly in the mapping, not the import. Someone has to decide whether a retired product maps to a replacement, a parent category, or a 404, and that decision needs merchandising input. The rewrite import itself is a bulk operation through the admin, and its effort depends on how clean your old URL list is. If your old platform exported a usable URL-to-URL map, the work is largely verification. If it did not, you are reconstructing history from logs and a crawl. Confirm the export format and the crawl data you own before deciding who builds the map.

The client keeps the commercial and operational duties in either model: approving the mapping, owning the redirect rules after launch, and watching search console errors and server logs for chains and 404s for months. A partner can take on the mapping, the import, the rewrite table audit, and a post-launch crawl, but the team that receives the store must be able to read url_rewrite entries and understand what a 301 does to traffic. If nobody on your side is available for that monitoring window, that gap matters more than the import itself. Confirm who holds the admin credentials, who can change web server rules, and who gets alerted when redirect errors rise.

How DeployOpen scopes and delivers redirect work

DeployOpen is a Chainscore Labs company that implements self-hosted open-source platforms inside your own infrastructure. The steps below follow redirect work from a written scope through mapping, staging and post-launch monitoring, so each stage has a named deliverable and an owner.

Fixed scope agreed in writing

Redirect work starts with a written scope that lists the URL sources in play: renamed products, retired categories, a replatform, or a bulk catalog change. The scope names what is in and out, including whether the rewrite table cleanup, the sitemap regeneration and the canonical checks are part of the job. A quote follows from that written scope, because DeployOpen does not publish a price list. Ask for the scope document before you compare offers.

Old-to-new URL mapping

Every redirect starts from a mapping file that pairs each legacy URL with its destination, reviewed by the merchandising and SEO owners before any rule is written. Mapping exposes chains, loops and destinations that return 404 once the catalog changes. Plan for the URLs that existing backlinks and paid campaigns still use, not only the ones listed in the admin.

Staging tests before cutover

Redirect rules are loaded and tested in a staging copy that mirrors the production catalog and store views. Each mapped URL is requested and the status code, final destination and hop count are recorded. Tests also cover multi-store setups, suffix variants and the canonical tag on the destination page. The test results become an acceptance record that the store owner signs off before launch.

Rewrite table size control

Large catalogs accumulate rewrite rows whenever products or categories change. DeployOpen reviews the rewrite table before and after the migration, removes duplicates and expired rules, and sets a rule for when redirects are retired. Confirm with your team how long legacy redirects must stay live, because that decision drives table growth for years.

Post-launch monitoring retainer

Monitoring continues after launch through a retainer. It covers scheduled crawls of the mapped URLs, error and 404 log review, alerts on new redirect chains, and checks after theme or extension changes. Retainer scope, reporting cadence and response expectations are written into the agreement, so ask for them explicitly in the quote.

Delivery inside your infrastructure

All configuration, mapping files and test data stay in your environment, whether on your cloud account, a data center or an air-gapped network. Changes move through your own deployment pipeline with a documented rollback path. The store runs on Magento Open Source, so the handover includes the rewrite configuration, the mapping source and the runbook your team needs to maintain it.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.