PS PrestaShop Beginner

dfredirects — 301 Redirects Manager

Install and configure the 301 redirects manager for PrestaShop 8 and 9: rules, wildcard, regex, 404 monitoring and CSV import.

Updated Module version 1.0.1

Introduction

dfredirects is a complete redirects manager for PrestaShop 8 and 9. It handles HTTP codes 301, 302, 307, 308 and 410, offers three matching strategies (exact, wildcard, PCRE regex), monitors 404 errors and automatically creates redirects whenever you change the slug of a product, category, CMS page, manufacturer or supplier.

Installation

  1. Go to Modules → Module Manager → Upload a module.
  2. Upload the dfredirects-1.0.1.zip file.
  3. Click Install.
  4. A new Redirects menu appears in the back office with four tabs: Dashboard, Rules, 404 Log and Import / Export / Settings.

The installation creates three tables: ps_dfredirects_rule (rules), ps_dfredirects_notfound (logged 404s) and ps_dfredirects_slug_snapshot (URL snapshots before modification). Uninstalling removes these tables and all configuration.

Requirements: PrestaShop 8.0 minimum, PHP 8.1 or higher. The module works identically on PrestaShop 9.

Configuration

Go to Redirects → Import / Export / Settings. Available settings:

  • Log 404 errors — master switch of the 404 logger.
  • Log bot 404s — whether to include requests from known bots (Googlebot, Bingbot, GPTBot, ClaudeBot, etc.). Recommended: disabled to keep a clean log.
  • Auto-redirect on slug change — enables automatic 301 creation on URL change.
  • Preserve query string by default — default value of the preserve_qs field for new rules.
  • 404 log retention (days) — retention period before automatic purge. 0 disables purging.
  • Default HTTP code — code used for automatically created rules (301 recommended).
  • Ignored URL patterns — one pattern per line, substring matching. Example: .well-known, wp-admin, autodiscover. Matching URLs will never be logged.

Creating a redirect rule

In Redirects → Rules, click New rule. Each rule contains:

  • Source URL — the URL to intercept (relative path, e.g. /old-page).
  • Match type — exact, wildcard or regex (see below).
  • Target URL — the destination (relative path or absolute URL for an external domain). Empty for a 410 code.
  • HTTP code — 301 (permanent, SEO recommended), 302 (temporary), 307/308 (preserve HTTP method), 410 (permanently removed content, no target).
  • Preserve query string — if enabled, ?utm_source=x is forwarded to the target.
  • Shop / Language — rule scope. 0 = all shops / all languages.
  • Note — free field for your annotations.

Exact matching

The requested URL must match the source exactly (after normalization: lowercase, no query string, no trailing slash). This is the most performant type — indexed database lookup, constant cost whatever the table size.

Wildcard matching

The asterisk * captures any sequence. Captures are reusable in the target with $1, $2, etc.

Source : /old-category/*
Target : /new-category/$1

/old-category/my-product  →  /new-category/my-product

Regex matching

Full PCRE syntax between tilde delimiters. Capturing groups are used with $1, $2, etc. Use the [0-9] class for digits.

Source : ~^/product/([0-9]+)/(.*)$~
Target : /p/$1-$2

/product/42/cool-thing  →  /p/42-cool-thing

The e modifier (code evaluation) is automatically stripped for security. Invalid regex rules are refused at creation and import.

Automatic redirects on slug change

When the option is enabled, the module captures each object’s URL before its update (hook UpdateBefore), compares it after the update (hook UpdateAfter), and creates a 301 redirect if the URL changed. This works for products, categories, CMS pages, manufacturers and suppliers, for each active language and shop.

When a product is deleted, a redirect is created to its default category. When a category is deleted, to its parent category. If no relevant target exists, the fallback is the homepage.

Chain and loop detection

If a rule A→B exists and you change B’s slug to C, the module automatically updates rule A to point directly to C (recursive resolution, 5 levels max). Rules updated this way carry the [chain-fix] mention in their note. Loops (A→B→A) are detected and creation is refused.

Automatic redirects are only created if the object’s link_rewrite is filled in the concerned language. Malformed URLs (segments composed only of digits and dashes) are rejected.

404 monitoring

Every not-found page is recorded in Redirects → 404 Log with the URL, referrer, user-agent, IP address, hit counter and last visit date. The default filter hides bots and already resolved entries.

Creating a redirect from a 404

Click the Create redirect action on a 404 entry. The module analyzes your catalog and suggests up to 5 likely targets (products, categories, CMS pages) ranked by similarity, with a visual score. Select a suggestion or enter a manual URL, choose the HTTP code, confirm: the rule is created and the 404 is marked resolved.

CSV import and export

File format

source_url,target_url,match_type,http_code,id_shop,id_lang,preserve_qs,active,note
/old-page,/new-page,exact,301,0,0,1,1,migration 2026
/produits/*,/products/$1,wildcard,301,0,0,1,1,fr to en
~^/cat-([0-9]+)/$~,/category/$1,regex,301,0,0,1,1,numeric ids

Only the source_url and target_url columns are required (target optional for a 410 code). Comma, semicolon, tab and pipe delimiters are auto-detected. The Update existing rules option enables UPSERT: an existing source is updated instead of skipped.

The import report shows the number of rules imported, updated, skipped, and the detail of errors line by line (invalid regex, missing source, etc.).

Export

The Download CSV button exports all rules in UTF-8 with BOM, directly openable in Excel.

Dashboard

The dashboard displays: the number of active rules (with the auto-generated share), total redirects served, the number of unresolved 404s, the 30-day 404 trend, the top 5 most frequent 404s, the top 5 most used redirects, and the list of dead rules (created more than 90 days ago, never triggered) — candidates for deletion to keep a lean table.

Troubleshooting

My redirect is not triggered

  • Check that the rule is active and that its shop / language scope matches the request.
  • Exact rules are evaluated before wildcard and regex: check that an exact rule is not shadowing your pattern.
  • Clear the PrestaShop cache (var/cache/).

Too many 404s generated by bots

Disable Log bot 404s in settings, or add patterns in Ignored URL patterns (e.g. .well-known, wp-, autodiscover).

The auto-redirect was not created on slug change

  • Auto-redirect only triggers when the link_rewrite actually changes — a name-only modification is not enough.
  • Check that the Auto-redirect on slug change option is enabled.
  • If the object was disabled or its link_rewrite was empty in the concerned language, no snapshot is taken.

Changelog

1.0.1 — May 11, 2026

  • Validation of generated URLs before saving: rejects malformed sources.
  • Skips generation if link_rewrite is empty for the current language or shop.

1.0.0 — May 11, 2026

  • Initial release: redirect engine (exact / wildcard / regex), 404 monitoring, auto-redirect, CSV import/export, suggestions, dashboard.
Was this page helpful?

Still stuck? Contact support