# etechflow/module-redirect-manager

> 301/302 redirect manager with auto-redirect on URL-key change and a 404 catcher.

`composer require etechflow/module-redirect-manager`

Canonical URL: https://packagento.com/etechflow/module-redirect-manager

## At a glance

- **Vendor**: etechflow (https://packagento.com/etechflow.md)
- **Latest version**: 1.0.0 — released 2026-06-05
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/etechflow/module-redirect-manager and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require etechflow/module-redirect-manager:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

301/302 redirect manager with auto-redirect on URL-key change and a 404 catcher.

## README

A 301/302 **redirect manager** with a built-in **404 catcher** for Magento 2 / Adobe Commerce.
Part of the Etechflow SEO Suite. A leaner alternative to the redirect tools in Mirasvit/Amasty.

### Features

- **301 / 302 redirects** managed from the admin (grid + add/edit form), per store view, with an
  active toggle, internal notes, and a live **hit counter** per redirect.
- **Runs before `urlrewrite`** — a custom router (sortOrder 15) so managed redirects take
  precedence over catalog/CMS URL rewrites.
- **404 catcher** — every not-found URL is logged (with hit count + referrer). One click on a
  404 row creates a draft redirect and opens it for you to set the target.
- Target can be a **path** (`new-page`) or a **full URL** (`https://…`).
- Fully **flag-gated** — master switch (off by default); inert until enabled.
- Configurable **exclude regex** so static assets / noise aren't logged.

### Where it lives

- **Marketing → Redirect Manager → Redirects** — the redirect grid
- **Marketing → Redirect Manager → 404 Log** — captured 404s + "Create Redirect"
- **Stores → Configuration → Etechflow → Redirect Manager** — settings

### Configuration

| Path | Default | Notes |
|------|---------|-------|
| `etechflow_redirectmanager/general/enabled` | `0` | Master switch (engine + 404 logger) |
| `etechflow_redirectmanager/redirects/default_type` | `301` | Default status for new redirects |
| `etechflow_redirectmanager/log404/enabled` | `1` | Log not-found URLs |
| `etechflow_redirectmanager/log404/exclude_patterns` | asset regex | Paths matching are not logged |

### URL-key changes

Magento's native *"Create Permanent Redirect for old URLs"* (Stores → Configuration → Catalog →
Catalog → Search Engine Optimization) still creates `url_rewrite` 301s on product/category URL-key
changes. This module's **404 catcher backstops** anything that slips through, so you can convert it
to a managed redirect in one click.

### Install

```bash
bin/magento module:enable Etechflow_RedirectManager
bin/magento setup:upgrade
bin/magento setup:static-content:deploy <locale> -f --area frontend   # prod: setup:upgrade clears var/view_preprocessed
rm -rf generated/code/* generated/metadata/*                          # di:compile won't clean this itself
bin/magento setup:di:compile
bin/magento cache:flush
bin/magento config:set etechflow_redirectmanager/general/enabled 1
```

### Tables

- `etechflow_redirect` — managed redirects (request_path → target_path, type, store, active, hits)
- `etechflow_redirect_404_log` — captured 404s (request_path unique per store, hit upsert)

### Tests

```bash
vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist app/code/Etechflow/RedirectManager/Test/Unit
```

## Changelog

All notable changes to this module are documented here.

### v1.0.0 — 2026-06-05

Initial public release.

301/302 redirect manager + 404 catcher. Admin grid + hit counters, custom router runs before urlrewrite. One-click create-redirect from a 404 row.

## Recent Versions

| Version | Released |
|---|---|
| 1.0.0 | 2026-06-05 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | >=103.0 |
| magento/module-backend | >=102.0 |
| magento/module-cms | >=104.0 |
| magento/module-store | >=101.0 |
| php | ~8.1.0\|\|~8.2.0\|\|~8.3.0\|\|~8.4.0 |

## Quality

Latest release (1.0.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | not tested |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Fail | 16 | 1 error, 15 warnings (ruleset: Magento2) — 1 auto-fixable with phpcbf |
| PHPMD | Warning | 3 | 3 rule violations (MissingImport:1, ErrorControlOperator:1, UnusedFormalParameter:1) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 5 | valid; 5 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 10 | 10 | – | – |
| 2.4.8 | – | 10 | 10 | – |
| 2.4.9 | – | – | 10 | N/A |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["etechflow/module-redirect-manager"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

etechflow is a Magento 2 vendor on Packagento. See https://packagento.com/etechflow.md for their full catalogue.

