Download the PHP package jainamdeveloper/magento2-custom-redirect without Composer
On this page you can find all versions of the php package jainamdeveloper/magento2-custom-redirect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jainamdeveloper/magento2-custom-redirect
More information about jainamdeveloper/magento2-custom-redirect
Files in jainamdeveloper/magento2-custom-redirect
Package magento2-custom-redirect
Short Description Magento 2 module for custom redirect handling on NoRoute pages. Handles intelligent redirects for categories and products on 404 pages.
License MIT
Informations about the package magento2-custom-redirect
Magento 2 Custom Redirect — 404 NoRoute Handler
A lightweight Magento 2 module that automatically recovers visitors from 404 pages by redirecting them to the most relevant active page using 301 redirects. Instead of bouncing customers to a dead end, this module intelligently resolves deleted or disabled URLs to their best matching destination.
Why Use This Module
When you restructure your Magento 2 store — disable categories, remove products, or migrate from a legacy URL structure — customers and search engines hit 404 pages. Every 404 is a lost visitor and a wasted SEO signal.
This module intercepts every NoRoute (404) request in Magento 2 and resolves it automatically:
- Disabled or deleted category URL: visitor lands on the nearest active parent category, staying in the right section of the store
- Removed product URL: visitor lands on an active category the product belonged to, so they can still browse alternatives
- Legacy URL patterns (e.g.
view-shape/<sku>): old external links and bookmarks resolve directly to the correct product page - Unresolvable 404: visitor is sent to the store homepage — no dead ends, no lost sessions
Net result: fewer exits, preserved SEO link equity via 301 signals, and old URLs never fully break.
How It Works
The module registers an aroundPlugin on Magento\Cms\Controller\Noroute\Index::execute. On every 404 request in Magento 2:
- Looks up the requested path in the
url_rewritetable - If a rewrite exists, determines entity type (category or product) and finds the best active redirect target
- If no rewrite exists, checks legacy URL patterns
- Falls back to the store homepage if no valid target is found
All redirects are issued as HTTP 301 (permanent), so search engines transfer link equity to the new URL.
Requirements
- Magento 2.4.4 – 2.4.9
- PHP 8.1 – 8.5
Installation
Via Composer (recommended)
Manual Installation
- Copy the module files to
app/code/Magneto/CustomRedirect/ - Run the following commands:
Redirect Logic Reference
| Incoming URL type | Redirect Target |
|---|---|
| Disabled/deleted category | Nearest active parent category |
| Removed/disabled product | First active category the product belonged to |
Legacy view-shape/<sku> URL |
Product URL resolved by SKU |
| Any other 404 | Store homepage |
Keywords
Magento 2 custom redirect, Magento 2 404 redirect, Magento 2 NoRoute plugin, Magento 2 301 redirect, Magento 2 SEO redirect, Magento 2 category redirect, Magento 2 product redirect, Magento 2 URL rewrite redirect, Magento 2 404 handler, Magento 2 page not found redirect
License
MIT
All versions of magento2-custom-redirect with dependencies
magento/framework Version >=103.0.0
magento/module-catalog Version >=104.0.0
magento/module-cms Version >=104.0.0
magento/module-store Version >=101.0.0
magento/module-url-rewrite Version >=102.0.0