PS PrestaShop Beginner

DF Smart 404: Documentation

Install, configure and use DF Smart 404: product suggestions on 404 pages, 404 log, one-click and automatic 301 redirects, CSV import, dashboard and email report.

Updated Module version 1.4.0

Overview

DF Smart 404 turns the “page not found” pages of your shop into useful pages. When a visitor lands on a broken URL, the module extracts its keywords, shows the best matching products and categories with your theme’s product cards, and pre-fills the search form.

In the back office, every 404 is recorded in a log. A broken URL can be 301-redirected to the right product in one click, in bulk, or automatically on the first visit when the match is reliable. A dashboard measures rescued visits and recovered revenue.

What the module does

  • Shows a suggestion block on every 404: unknown URLs, plus deleted or disabled products, categories and CMS pages.
  • Renders products with the theme’s product list template, or with compact cards.
  • Pre-fills the search with the keywords of the broken URL.
  • Logs every 404 with a hit counter, referer and user-agent.
  • Creates 301, 302 or 410 redirects, in one click, in bulk, automatically or by CSV import.
  • Measures rescued visits, recovered orders and revenue, and sends them by email.

Requirements

  • PrestaShop 8.0 to 9.x
  • PHP 7.4 or higher
  • No external dependencies, no Composer

Installation and update

  1. Go to Modules > Module Manager.
  2. Click Upload a module and drop the df404smart-1.4.0.zip file.
  3. Click Install.

On installation, the module creates five SQL tables (404 log, redirects, daily statistics, internal links and the pages where they appear), registers eleven hooks and adds a Smart 404 entry under Modules with two sub-tabs: 404 log and Redirects.

To update from a previous version, upload the new ZIP the same way. The upgrade scripts keep your settings, your log and your redirects, add the new tables and columns, and clear the Smarty and CSS caches.

Version 1.4.0: missing CMS pages, brands and suppliers now answer a real 404, the CSV exports are plain text and can be imported again, and targets on your shop are stored as paths. The upgrade converts your existing rules: the redirects themselves do not change.

The block is active right away with working default settings. To see it, open a URL that does not exist on your shop, for example /en/premium-leather-sneakers.

The dashboard

The module’s Configure page opens on the Dashboard tab. Choose the period at the top: 7, 30 or 90 days.

  • Broken URLs to fix: log entries still in the “New” status, with the total of their visits.
  • 404 visits: visitors who landed on a broken URL during the period.
  • Rescued visits: visitors redirected before seeing an error.
  • Recovery rate: share of rescued visits among all visits to broken URLs.
  • Orders after a 404: attributed orders, with the number of clicks in the suggestion block.
  • Recovered revenue: tax-excluded amount of these orders, in the default currency.

Below the indicators, a daily chart stacks rescued visits and visits that landed on the 404 page. Hover over a column to see the details for that day, or open the data table below the chart. Next come the URLs to fix first, with one-click actions, then recommendations based on your configuration.

PrestaShop 404 dashboard: broken URLs, rescued visits, recovery rate and recovered sales
PrestaShop 404 dashboard: broken URLs, rescued visits, recovery rate and recovered sales

Settings

The Settings tab contains three blocks.

404 page

  • Enrich the 404 page: enables the suggestion block on every 404 page.
  • Replace the default 404 content: hides the theme’s message and search field so only one remains. See display by theme.
  • Real 404 for missing CMS pages, brands and suppliers: PrestaShop answers a deleted or disabled CMS page, brand or supplier with a temporary redirect (302) to the “page not found” page, which search engines treat as a soft 404. With this option, enabled by default, the page answers 404 under its own URL, with the suggestion block, and is added to the log. See real 404.
  • Product display: Theme product miniatures (recommended) or Compact cards, styled by the module.
  • Number of suggestions: from 0 to 12 products. A value of 0 disables suggestions and keeps the search.
  • Suggest categories: up to 3 related categories as quick links.
  • Show the search form: field pre-filled with the URL keywords.
  • Title when products match, Title when nothing matches and Introduction text: texts customizable per language. Leave a field empty to keep the default text.

Redirects

  • Enable the redirect engine: applies your rules before the page is displayed. Disable it if another module already manages your redirects.
  • Automatic mode: creates and applies a redirect on the first visit of a broken URL that clearly matches a product or category. Disabled by default.
  • Deleted or disabled pages: what happens when a product, a category or a CMS page is deleted or disabled and PrestaShop would answer 404: Add the URLs to the log with a proposed target (recommended), Create the redirect to the nearest category automatically or Do nothing, wait for a visit. See 404s detected before any visit.
  • Default redirect type: 301 permanent (recommended for SEO) or 302 temporary.
  • Keep the query string: forwards the query string to the target, so that utm_source and similar parameters survive the redirect.

Tracking and email report

  • Email report, Frequency (daily or weekly) and Recipients (addresses separated by commas). No report is sent if nothing happened during the period.
  • Log bot traffic: disabled by default, hits from known bots are not written to the log.
  • Log retention (days): 90 days by default. Older entries are purged, redirect rules never are.
  • Exclusion patterns: one case-insensitive regular expression per line. Matching URLs are not logged.

The default patterns filter out static files (images, CSS, JS, fonts), script extensions (.php, .env, .sql…), and the paths targeted by scanners: wp-admin, xmlrpc, phpmyadmin, .git, .well-known, cgi-bin, autodiscover.

A URL that matches an exclusion pattern keeps the plain 404 page of the theme: no suggestions are computed for traffic nobody reads, such as missing images or vulnerability scanners.

Smart 404 page and redirect engine settings, with real 404 for CMS pages, brands and suppliers
Smart 404 page and redirect engine settings, with real 404 for CMS pages, brands and suppliers

The 404 page on the front office

Which pages are covered

The module acts on every 404 response of the shop: the PrestaShop page-not-found page, and also deleted or disabled products, categories and CMS pages, which PrestaShop renders from their own controller with a 404 status. AJAX requests are ignored.

Real 404 instead of a redirect

For a missing or disabled CMS page, brand or supplier, PrestaShop does not answer 404: it sends a temporary redirect (302) to its “page not found” page. Search engines see a redirect to an error page, a soft 404, and the original URL is lost. With Real 404 for missing CMS pages, brands and suppliers, the module answers 404 directly under the original URL, shows the smart block and logs the URL. A redirect rule created in the module for that URL still applies first, and a disabled CMS page previewed from the back office stays visible.

Disabled CMS page answering a real 404 with the smart block instead of a 302
Disabled CMS page answering a real 404 with the smart block instead of a 302

How products are selected

The module splits the last two segments of the URL into keywords. It filters out stop words and route words (home, product, category, html…) in eight languages, keeps only words of at least three characters, excludes numbers and reduces plurals to their singular form: “sneakers” also finds “sneaker”. The language segment (/fr/, /en/…) is used to choose the search language.

Products are ranked first by the number of keywords found, then by a weighted score:

  • keyword in the link_rewrite: 4 points
  • keyword in the name: 3 points
  • keyword in the reference: 2 points

Products and categories that the visitor’s customer group cannot see are never suggested.

The fallback

With no match, the module shows best sellers, then new products if there are not enough sales, under the “nothing matches” title. The visitor always sees products.

Display by theme

The block is inserted after the theme’s 404 content, across the full width of the page container. Products go through the theme’s catalog/_partials/productlist.tpl template, like the featured products module: prices, strikethrough prices, labels and quick view are the same as in your listings.

  • Classic and child themes: with Replace the default 404 content, the native box is hidden. The title, the search and the categories are shown in a 720 px white box, with the products below, two per row on mobile and four from 992 px.
  • Hummingbird: the theme keeps its title, its text and its back button. Products follow the theme’s grid.
  • Other themes: the block is placed after the #content container, and the replacement option only hides the native search field. If no known container is found, the block is placed just before the footer.

No theme file is modified. To adjust the style, override the .df404smart classes in your theme’s CSS.

The search form

The field is pre-filled with the URL keywords: a visitor who lands on /premium-leather-sneakers-edition sees “premium leather sneakers edition”. The form points to the native search page, which avoids any conflict with a third-party search module.

Smart 404 page with product suggestions, category link and search pre-filled from the broken URL
Smart 404 page with product suggestions, category link and search pre-filled from the broken URL
Smart 404 page on mobile with product suggestions from the broken URL
Smart 404 page on mobile with product suggestions from the broken URL

The 404 log

Menu Modules > Smart 404 > 404 log. The list is sorted by hits in descending order: the URLs that cost the most visits come first.

Columns and statuses

  • Broken URL: the requested path, normalized.
  • Hits: number of visits. A URL produces a single row per shop, whatever the number of visits.
  • Last referer: where the last visitor came from.
  • Origin: Visit, Deleted or disabled (with the product, category or CMS page concerned), Search Console or Internal link.
  • Status: New, Redirected, Ignored or Gone (410).
  • Last hit: date of the last visit.

A redirected URL that returns a 404 again, for example because the rule was disabled, goes back to the “New” status.

Actions

  • Auto redirect: creates the redirect to the best match, without leaving the page.
  • Create redirect: opens the guided form.
  • Ignore: removes the URL from the indicators without deleting it.
  • Delete: erases the entry.

The bulk actions Auto redirect selected, Ignore selected and Delete selected handle several URLs at once. With bulk auto redirect, only reliable matches are redirected, the others remain to be handled. CSV export is available from the toolbar, in plain text.

Log of the 404 errors of the PrestaShop shop with hits, referer, origin and status
Log of the 404 errors of the PrestaShop shop with hits, referer, origin and status

404s detected before any visit

The log does not wait for a visitor to land on a broken URL. Three sources add URLs that already answer 404, with no hit yet:

  • Deleted or disabled: when a product, a category or a CMS page is deleted or disabled, its URLs in every language and every shop go to the log with the nearest active category as proposed target, or the 301 is created at once, depending on the Deleted or disabled pages setting. Products that PrestaShop already redirects with their own redirection setting are left alone. A page put back online releases its entries and disables the rules created for it.
  • Search Console: import of the “Not found (404)” report of Google Search Console, see Import a Search Console report.
  • Internal link: broken links found by the internal links analysis.

The dashboard shows how many of these URLs are still to handle, with a shortcut to the filtered log. The one-click redirect uses the proposed target first.

Create a redirect

One-click redirect

The module looks for a product first, then a category. It only accepts a reliable match: two thirds of the keywords of the URL covered, and a winner that is clearly ahead of the runner-up. The target is built in the language of the broken URL. If these conditions are not met, the module sends you to the guided form.

A URL like /summer-sale-2025 has no reliable match: it stays a 404 with suggestions, and it is up to you to choose the target.

Automatic mode

With Automatic mode enabled, the same check runs in real time, on the first visit of a broken URL. If it succeeds, the rule is created and the visitor is redirected immediately. Only pages visible to a visitor who is not logged in can be used as a target. Rules created this way have the Automatic origin in the redirect list.

The guided form

It shows the broken URL, its number of hits, the detected keywords, then the suggested products and categories with their match percentage. Pick a suggestion or enter a custom URL (category, CMS page, external URL), then the redirect type.

Before saving, the module checks that the target is valid, that it does not point back to the source and that no rule already exists for this source.

Guided form to create a 301 redirect, products and categories ranked by match
Guided form to create a 301 redirect, products and categories ranked by match

Manage redirects

Menu Modules > Smart 404 > Redirects. The list can be exported to CSV from the toolbar and imported again as is.

  • Source URL: the broken path, as it appears after the domain.
  • Target URL: path starting with a slash, or full https URL. Addresses of your shop are saved as a path, so the rule keeps working after a domain change or the switch to HTTPS.
  • Type: 301 permanent, 302 temporary, or 410 for a page removed for good.
  • Origin: Manual or Automatic.
  • Hits: visits intercepted by the rule.
  • Active: disables a rule without deleting it.
List of 301, 302 and 410 redirects with hits and automatic rules
List of 301, 302 and 410 redirects with hits and automatic rules

410 rules

A 410 rule has no target. It responds with the HTTP 410 status to tell search engines the page will not come back, and the visitor still sees the smart 404 page with its suggestions. The URL switches to the “Gone (410)” status in the log.

The redirect engine

Rules are evaluated before the page is displayed, only for GET and HEAD requests: a form submitted with POST is never redirected. Paths are normalized before comparison. The module rejects loops and duplicates, and flattens chains: if X redirects to A and you create A to B, rule X points directly to B.

Tools

Test a URL

Enter a URL to see what the module does with it: normalized path, detected language, keywords, existing rule, possible exclusion by a pattern, suggestions and the page a one-click redirect would choose. Useful to check a redirect plan before a migration.

URL tester: detected language, keywords and suggested redirect for a broken URL
URL tester: detected language, keywords and suggested redirect for a broken URL

The Broken internal links card reads the links of your CMS pages, product and category descriptions, main menu, link blocks and slider, then the pages as visitors see them: home page, CMS pages, up to 100 categories and the 15 most recently updated products, in every language. Links shown by other modules, the theme or a page builder are therefore checked too. Each link is then requested once.

  • Links answering 404 or 410 are added to the log, with the page where they appear and a button to create the redirect.
  • Links that point to a redirect are listed separately: point them to the final page.
  • A link present on many pages (menu, footer) is listed once, with the number of pages.

The analysis runs in short steps from the back office. To repeat it every week, call the cron URL shown in the card several times in a row, each call works about 25 seconds. Fixing the link in the page is better than a redirect: visitors and search engines reach the right page directly.

Analysis of broken internal links on the PrestaShop shop, with the pages to fix
Analysis of broken internal links on the PrestaShop shop, with the pages to fix

Import a Search Console report

In Google Search Console, open Indexing > Pages, click Not found (404), export the list and choose the Table.csv file, or paste the URLs, one per line. Up to 1,000 URLs per import.

The report can be several weeks old: with Only add URLs that still answer 404, each URL is requested first and only those that still answer 404 or 410 are added. The summary details the URLs that answer normally again, those already redirected or covered by a rule, those excluded by a pattern and those that belong to another site.

Import of a Google Search Console 404 report with a live check of each URL
Import of a Google Search Console 404 report with a live check of each URL

Import redirects

CSV file, one rule per line: source;target;type. The type is 301, 302 or 410, or the default type if empty. The header line is optional.

  • The delimiter (semicolon, comma, tab, pipe) and the encoding (UTF-8 with or without BOM, Windows-1252) are detected.
  • The module’s own export and most exports from other tools are recognized, as soon as the header names a source column and a target column.
  • Check Update rules whose source already exists to overwrite a source that is already present. Otherwise, it is skipped.
  • Limits: 5 MB and 10,000 rows per file.

The summary shows the rules created, updated and skipped, with the reason for each rejected row.

Email report

The report summarizes lost and rescued visits, recovered revenue and the URLs to fix first. It is available in eight languages. The Send a report now button sends it immediately to test your email settings.

Sending is triggered on its own when you use the back office, or on the shop after the response to the visitor. For an exact schedule, call the Cron URL (optional) shown in the tab every hour. It is protected by a token.

Statistics and recovered revenue

Every day, the module counts visits on broken URLs, visits rescued by a redirect, clicks in the suggestion block, orders and their amount. Bots are not counted. Totals are kept for 400 days.

An order is attributed when it is placed within 24 hours after a redirect or a click in the block. The amount is taken tax excluded and converted into the default currency. The same cart is only counted once.

This is attribution: it shows that the visitor ordered after being rescued, not that they would not have ordered without the module. An order confirmed later by a payment notification, outside the visitor’s session, may not be counted.

Performance

  • The redirect engine runs an indexed lookup before the page is displayed.
  • The log and the statistics only write when a 404 occurs, with one upsert query each.
  • The purge of old entries is triggered on about 1% of hits, on an indexed date column. The log is capped at 100,000 rows: beyond that, single visits still to handle are removed first, oldest first.
  • A URL matching an exclusion pattern gets the plain 404 page, without suggestion queries.
  • The email report is sent after the response has been sent to the visitor, when PHP-FPM allows it.

Multistore

The log, redirects, statistics and suggestions are scoped per shop. A broken URL on shop A does not appear in the log of shop B, and the dashboard follows the selected shop context.

GDPR

The log stores the broken URL, the referer and the user-agent. No IP address or personal data is stored. Statistics are daily totals. Order attribution uses the PrestaShop cookie that is already present. The module sends no data to any external service.

Uninstall

Uninstalling deletes the module’s five tables, the back-office tabs and the configuration. Redirects and statistics are lost.

Before uninstalling, export your redirects from Tools > Export current redirects. The file can be imported again as is.

Troubleshooting

The block does not show up

  • Check that Enrich the 404 page is enabled.
  • Clear the cache in Advanced Parameters > Performance.
  • Check that the tested URL is not filtered out by an exclusion pattern, with Tools > Test a URL.

Products are cramped or misaligned

Since version 1.2.2, the block is placed outside the theme’s 404 box and uses the theme’s product list. If you still see a narrow layout after the update, clear the Smarty cache and the CCC cache. On a heavily customized theme, try Compact cards.

Two search fields are displayed

Enable Replace the default 404 content, or disable Show the search form to keep the theme’s field.

No product is suggested

  • Check that Number of suggestions is not set to 0.
  • Products must be active, visible and accessible to the visitor’s group.

The one-click redirect is refused

This is the expected behavior when the match is not reliable. The guided form shows suggestions even below the threshold, and accepts a custom target.

A redirect is not applied

  • Check that Enable the redirect engine is checked and that the rule is active.
  • Check that the rule belongs to the right shop.
  • Test the URL in Tools: the existing rule is shown if it is found.
  • Another redirect module may intercept the request before this one.

The email report does not arrive

Use the Send a report now button in the Tools tab. If sending fails, check the email configuration of your shop in Advanced Parameters > E-mail. If your shop has little traffic, schedule the cron URL.

The analysis and the Search Console check request your shop from the server itself. Maintenance mode, a password protection or a firewall can refuse these requests: add the server IP address to the maintenance IPs, or allow the DF404SmartBot user agent.

Support

12 months of updates and 12 months of email support are included with your license. The PHP source code is provided in full, not obfuscated.

Was this page helpful?

Still stuck? Contact support