1. What this module does

When you move a shop to PrestaShop, rename products or delete categories, the old addresses stop working: visitors from Google and old links land on "Page not found", and the shop loses its positions in search results. The module sends such visitors to the right page with a 301 redirect (Google moves the ranking to the new address) or a 302 redirect, and it keeps a log of every address that ended in a 404 page, so you see what is broken and fix it in one click.

Works with PrestaShop 1.7.8, 8.x and 9.x (PHP 7.2.5 or newer), with the Classic and Hummingbird themes and with multistore.

2. Installation

  1. Download the module from My account → Order history at addonspresta.com.
  2. In your Back Office, open Modules → Module Manager and click Upload a module.
  3. Drop the ap_redirects_v1.0.0.zip file and wait for the confirmation.
  4. Click Configure on the module card.

Right after installation redirects and the 404 log are on. The log starts filling as soon as visitors reach missing pages.

3. How it works

Every storefront page opened by a visitor or a search engine goes through the module before PrestaShop builds it. The module compares the address with your redirects:

  • first a redirect of exactly this address with its query (?…), then of exactly this path;
  • then the longest "starts with" redirect, for example /blog/ for every old blog address;
  • a redirect of the shop selected in multistore wins over a redirect for all shops.

When a redirect matches, the visitor goes straight to the new address and the redirect's counter goes up. Forms sent by the visitor, AJAX calls and the Back Office are never redirected.

Addresses are compared without the domain, decoded (%20 is a space), with upper and lower case and the final slash as typed. The query of the visitor's address is not added to the new address.

When a page is answered with "Page not found" (code 404) — a wrong address, a deleted product, category or CMS page — the module writes the address in the 404 log, or increases its number of visits, with the date and the last referrer (the page the visitor came from). Both are stored without the part after ?, which may contain codes of other pages. It stores no IP address and nothing about the visitor.

Images, CSS and JavaScript files are served by the web server itself and never reach PrestaShop, so the module can neither redirect nor log them. The module does not change PrestaShop tables and does not connect to addonspresta.com or any other server.

4. Features and settings

Open Modules → Module Manager → 301 Redirects & 404 Log → Configure. The Help box at the top links to this manual and to the module page at addonspresta.com, in the language of your Back Office.

Settings

  • Redirect old addresses — switch off to stop every redirect at once without deleting them.
  • Log 404 pages — switch the 404 log on or off.
  • Keep at most … log entries — from 100 to 100,000 (5,000 by default). The addresses not visited for the longest time are removed first.

Redirects

The list shows 50 redirects per page with the old address, the match, the new address, the type, the number of hits and the last hit. Use the search box to find an address and the page numbers to browse. Click the status icon to switch a redirect on or off, Edit to change it and Delete to remove it. Click Add a redirect (the + button of the list) to create one:

  • Old address — the address that no longer works, as a full URL (https://old-shop.com/en/old-product.html) or a path (/en/old-product.html). The domain is ignored. Type a query (?id_product=12) only when the old address had one that matters.
  • Match — Exactly this address, or Every address that starts with it to move a whole old category or blog: /blog/ catches /blog/post-1 and /blog/2019/post-2. End a prefix with / so that /blog does not also catch /blogger.
  • New address — a path in this shop (/en/new-product.html) or a full URL starting with https://.
  • Type — 301 when the page moved for good (search engines move its ranking), 302 for a temporary move.
  • Enabled — a disabled redirect is kept but not used.

A redirect whose new address leads back to the old one (also as a full URL of your shop) is refused, because it would redirect forever, and so is a new address that another redirect sends further: enter the final address instead. Each old address can have one exact redirect and one "starts with" redirect per shop.

404 log

The log lists the addresses that ended in a 404 page, most visited first, with the first and last visit and the last referrer. Redirect opens the redirect form with the address already filled in: enter the new address and save; the address leaves the log. Delete removes one address, Clear the log removes every address shown.

Import and export

  • Export downloads the redirects of the list as a CSV file that opens in Excel or LibreOffice.
  • Import reads a CSV file saved as UTF-8 (.csv or .txt, up to 2 MB and 10,000 lines), with ;, , or a tab between the columns: old address, new address, then optionally type (301 or 302), match (exact or prefix) and active (1 or 0). A header line is allowed. A line whose old address already has a redirect updates it. After the import you see how many redirects were added, updated and skipped, with the line numbers and reasons of the first 20 skipped lines.

5. Multistore

Select a shop in the Back Office header to see and change its own redirects (and the redirects for all shops) and its 404 log; new redirects then apply to that shop only. With All shops selected, the lists show every shop with a Shop column and new redirects apply to all shops. An employee who does not manage every shop sees only the redirects and logs of their own shops and adds redirects with a single shop selected. The settings follow the shop or shop group of the header. One licence covers every shop of the installation.

6. Uninstall

Module Manager → 301 Redirects & 404 Log → Uninstall deletes all redirects, the 404 log and the settings. Export your redirects first if you may need them again, or use Disable instead.

7. FAQ and troubleshooting

A redirect does not work. Check that the redirect and Redirect old addresses are on, that the old address in the rule is exactly the one in the browser (case, final slash, query), and that a page cache or a reverse proxy is not serving a stored copy. Try the address in a private browser window: browsers remember 301 redirects.

Can I redirect an address that still works, for example an existing product? Yes. Redirects run before PrestaShop builds the page, so they also apply to addresses that still exist.

The 404 log is full of addresses like /wp-login.php. These are bots looking for other shop software. Delete them or clear the log; they do no harm. The log keeps only the number of entries you chose.

My CSV import says the file is not UTF-8. Save the file as "CSV UTF-8" in Excel, or as UTF-8 in LibreOffice, then import it again.

How do I move the whole old domain? Point the old domain at the shop and add redirects of its paths: the domain of the old address is ignored, so the same rules work for both domains.

8. Updates and support

Updates are free for life: download new versions from My account → Order history at addonspresta.com and upload them like a new module. Your redirects, log and settings are kept.

Support is included for 12 months from your order: write to mail@addonspresta.com or use the contact form at addonspresta.com (Monday to Friday, 10:00–16:00 CET; we usually answer within 2 business days). Please include your PrestaShop version, the module version and the steps that lead to the problem.

Back to User manuals

Loading...
Back to top