WebP Config

Quick Setup Guide — just installed or enabled this module?

Follow these steps to make sure the WebP/AVIF images are served to visitors:

  1. Generate the WebP images — if they have not been generated yet, open the Image regeneration > Regenerate WebP images tab (left menu) and run the generator.
  2. Regenerate the .htaccess rewrite rules (needed after re-enabling the module) — when you disable the module the rewrite rules are removed automatically, so after re-enabling them you need to put them back. Open the CDN Configuration tab (left menu) and click the Regenerate .htaccess Rules button. On a fresh install this happens automatically — you do not need to do this step.

You can also run step 2 if the WebP images have already been generated but they still do not show up on your site.


Still not working? If you completed steps 1 and 2 above and the WebP images are still not being served, as a fallback go to Shop Parameters → Traffic & SEO and in the Set up URLs section click Save. This triggers PrestaShop to regenerate the .htaccess file with the WebP/AVIF rewrite rules this module needs.

Conversion Statistics Loading...
4692
Original Images
66.93 MB
3457
WebP Images
11.26 MB
0
AVIF Images
0 B
66.93 MB
Total Savings
 
WebP Coverage
73.7%
3457 / 4692 images converted -77.2% avg size
AVIF Coverage
0%
0 / 4692 images converted
Breakdown by Category
Category Original Original Size WebP WebP Size AVIF AVIF Size Missing
Products 3496 59.02 MB 3273 (93.6%) 10.92 MB 0 (0%) 0 B W: 223 A: 3496
Categories 532 3.47 MB 136 (25.6%) 232.99 KB 0 (0%) 0 B W: 396 A: 532
Manufacturers 287 1.94 MB 23 (8%) 45.55 KB 0 (0%) 0 B W: 264 A: 287
Suppliers 275 1.89 MB 11 (4%) 23.59 KB 0 (0%) 0 B W: 264 A: 275
Stores 101 569.43 KB 13 (12.9%) 45.65 KB 0 (0%) 0 B W: 88 A: 101
CMS 1 56.12 KB 1 (100%) 7.72 KB 0 (0%) 0 B A: 1
Original Images by Type
JPEG 4692 files 66.93 MB
PNG 0 files 0 B
Conversion Summary
WebP Savings 55.67 MB (-77.2%)
AVIF Savings 66.93 MB
Image Comparison Tool

Compare your original images with their WebP and AVIF versions. Click on any image to see a side-by-side comparison with file size details.

Orphan Cleanup Tool

What are orphan files?
Orphan files are WebP or AVIF images that no longer have a corresponding original image (JPG/PNG). This can happen when products or images are deleted from PrestaShop but the converted files remain.

Deleting orphan files is safe and will free up disk space. However, always backup your files before bulk deletion.

.htaccess Configuration
The WebP/AVIF rewrite rules are automatically added to your .htaccess file when you regenerate it from PrestaShop.

How it works:
  • WebP rules are always included when this module is installed
  • AVIF rules are automatically added when AVIF conversion is enabled in Settings
  • CDN headers (Cache-Control, CORS) are added when CDN mode is enabled below

Regenerate .htaccess

Click the button below to update your .htaccess file with the latest WebP/AVIF rules.

You can also regenerate the .htaccess from: Shop Parameters > Traffic & SEO > click "Save"

Current Status

WebP Rules Enabled
AVIF Rules Disabled (Enable in Settings)
CDN Headers Disabled
CDN Compatibility Settings

Enable this if you are using a CDN to serve your images. This will add caching and CORS headers.

Nginx Configuration Generator
Generate optimized Nginx configuration for serving WebP and AVIF images. This tool creates server configuration that automatically serves modern image formats to supported browsers.

Nginx

Detected: No

Apache

Detected: No

Other/Unknown

Configuration may need adjustment


Configuration Options

Path to your images directory

Generated Server Configuration
# ============================================================
# WebP Generator - Nginx Configuration
# Generated: 2026-10-07 05:06:00
# PrestaShop WebP/AVIF Image Serving Configuration
# ============================================================

# ============================================================
# MAPS - Browser capability detection
# Add these to http {} block or include file
# ============================================================

# Map for WebP support detection
map $http_accept $webp_suffix {
    default   "";
    "~*webp"  ".webp";
}

# Map for format preference (AVIF > WebP > Original)
map $http_accept $img_suffix {
    default "";
    "~*webp" ".webp";
}

# ============================================================
# LOCATION BLOCKS - Add these to server {} block
# ============================================================

# Image location with automatic WebP/AVIF serving
location ~* ^\/img/(.+)\.(jpe?g|png|gif)$ {
    set $base $1;
    set $ext $2;

    # Try WebP if supported
    set $webp_path $document_root/img/$base.webp;
    if (-f $webp_path) {
        set $webp_exists "true";
    }
    set $try_webp "${webp_exists}${webp_suffix}";
    if ($try_webp = "true.webp") {
        rewrite ^\/img/(.+)\.(jpe?g|png|gif)$ /img/$1.webp last;
    }

    # Browser caching
    expires 1y;
    add_header Cache-Control "public, immutable";
    add_header Vary Accept;
    etag on;
}

# WebP images
location ~* \.webp$ {
    add_header Content-Type image/webp;
    add_header Vary Accept;
    expires 1y;
    add_header Cache-Control "public, immutable";
    etag on;
}

# Gzip compression for SVG and other compressible images
# Note: WebP and AVIF are already compressed, gzip won't help
gzip on;
gzip_types image/svg+xml;
gzip_vary on;

# ============================================================
# MIME TYPES - Add to http {} block if not already present
# ============================================================

# Add these MIME types to your mime.types file or types {} block:
types {
    image/webp  webp;
    image/avif  avif;
}
Instructions:
  1. Add the "map" blocks to your nginx.conf http {} block
  2. Add the "location" blocks to your site's server {} block
  3. Test configuration: nginx -t
  4. Reload Nginx: nginx -s reload
# ============================================================
# WebP Generator - Simple Nginx Configuration
# Quick setup for WebP/AVIF serving
# ============================================================

# Add this to your server {} block

location ~* ^/img/(.+)\.(jpe?g|png)$ {
    add_header Vary Accept;
    expires 1y;
    try_files $uri$avif_suffix $uri$webp_suffix $uri =404;
}

# Required maps (add to http {} block)
map $http_accept $webp_suffix {
    default "";
    "~*webp" ".webp";
}

map $http_accept $avif_suffix {
    default "";
    "~*avif" ".avif";
}
This is a simplified configuration for quick setup. Use the full configuration for more control.
# ============================================================
# WebP Generator - Apache .htaccess Configuration
# Generated: 2026-10-07 05:06:00
# ============================================================

# MIME Types for WebP and AVIF
<IfModule mod_mime.c>
    AddType image/webp .webp
    AddType image/avif .avif
</IfModule>

# Content negotiation for WebP/AVIF
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Serve WebP if available and supported
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{REQUEST_FILENAME} (.+)\.(jpe?g|png|gif)$
    RewriteCond %1.webp -f
    RewriteRule ^(.+)\.(jpe?g|png|gif)$ $1.webp [T=image/webp,E=WEBP_FORMAT:webp,L]

</IfModule>

# Headers for caching and content negotiation
<IfModule mod_headers.c>
    # Add Vary header for proper caching
    <FilesMatch "\.(jpe?g|png|gif|webp|avif)$">
        Header append Vary Accept
    </FilesMatch>

    # Cache control
    <FilesMatch "\.(jpe?g|png|gif|webp|avif)$">
        Header set Cache-Control "public, max-age=31536000, immutable"
    </FilesMatch>
</IfModule>

# Browser caching with mod_expires
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/avif "access plus 1 year"
</IfModule>
Merge these rules with your existing .htaccess file. Make sure mod_rewrite and mod_headers are enabled.
Quick Reference

Best Practices

  • Always include "Vary: Accept" header for proper caching
  • Set long cache durations (1 year) for static images
  • Use AVIF first, then WebP, then original format
  • Test configuration before applying to production
  • Monitor server logs after changes

Useful Commands

nginx -t Test Nginx configuration
nginx -s reload Reload Nginx configuration
apachectl configtest Test Apache configuration
systemctl restart apache2 Restart Apache
Configuration

When this option is turned OFF: the product, category, supplier, store and manufacturer images will have webp extension. When turned ON: webp images will be served, but with JPG extension and Webp mime type (where the client browser supports it). This method is recommended when users on Internet Explorer and Safari are seeing broken images.

CWebP conversion settings

If CwebP is available on your server, but the generation of images does not work please try to disable the &quot;Try common system paths&quot; and restart the generation process.

Read more about all the available parameters here: https://developers.google.com/speed/webp/docs/cwebp#additional_options


In case of low or limited server resources (specifically memory) enabling this option will reduce memory usage.

Recommended to no

Note: Only cwebp supports all values. gd will always remove all metadata. ewww, imagick and gmagick can either strip all, or keep all (they will keep all, unless metadata is set to none)

Use WebP polyfill to improve old browser compatibility


AVIF Settings

AVIF availability: GD AVIF supported

EWWW cloud convert
EWWW Image Optimizer is a very cheap cloud service for optimizing images. After purchasing an API key, add the converter in the extra-converters option, with key set to the key.
The EWWW api doesn't support the lossless option, but it does automatically convert PNG's losslessly. Metadata is either all or none. If you have set it to something else than one of these, all metadata will be preserved.
  Setting a cron job

Setting up the cron job through the server - (Recommended)

There are many servers and hosting management systems, but this guide will help you to set up the Cron Job. In order to set up the Cron Job, you need to open the page where you manage your domain.

Once you have entered the management interface you should look for something like Cron Jobs or Scheduled Tasks. Now it's time to enter the schedule and the command.


A cron job is a task that repeats every X time

The cron job can be divided in three parts the schedule and the command and the output

Schedule + Command + Output


For example, this Cron Job:

50 * * * * curl -l -k "https://webp.demo9.prestachamps.com/module/webpgenerator/cron?key=c2b2d28f6a271f6ce979649992e4886160a5287728117b419be61feab18519b2" >/dev/null 2>&1

Will generate the images at minute 50 of every hour for every day and month indefinitely (0:50, 1:50, 2:50...)


The schedule tells the crob how often the command or script has to be executed.

In some systems, you will have to choose among prefedined options like once a day, every hour, every 3 hours... but in most cases, you will be able to choose the programmation yourself. To set up the schedule you will find 5 parameters to configure.

┌---------------- minute (0 - 59)
| ┌------------- hour (0 - 23)
| | ┌------------- day of month (1 - 31)
| | | ┌------------- month (1 - 12)
| | | | ┌------------- day of week (0 - 6), Sunday = 0 or 7
| | | | |
* * * * *

In each field you can set up a number or an asterisk.
The asterisk has the special meaning "every" ("every hour", "every minute"...)
You can also modify the asterisk operator by adding a slash and a number after it to set an interval.
To make it easier for you to understand. Here are the most common schedules to generate the missing WebP images:

Schedule What it does? Will be executed at...
0 * * * * Generate the missing WebP images each hour at minute 0 (0:00, 1:00, 2:00...)
0 */3 * * * Generate the missing WebP images every 3 hours at minute 0 (0:00, 3:00, 6:00...)
0 */6 * * * Generate the missing WebP images every 6 hours at minute 0 (0:00, 6:00, 12:00, 18:00, 24:00)
0 */12 * * * Generate the missing WebP images twice a day at minute 0 (0:00, 12:00)
0 0 * * * Generate the missing WebP images once a day at minute 0 (0:00)

This behaviour can also be applied to the other modifiers, although you probably won't need to use it.


Once we know what schedule will be using, the next step is to call the script that will generate the missing WebP images. Depending on the system you use you will be asked for a URL or a command.

Here you will find all the options, you just need to click on the one you need to use to copy it to your clipboard.


Cron URL Click to copy the URL

https://webp.demo9.prestachamps.com/module/webpgenerator/cron?key=c2b2d28f6a271f6ce979649992e4886160a5287728117b419be61feab18519b2

The command


Use CURL: (recommended method) Click to copy the curl command
curl -l -k "https://webp.demo9.prestachamps.com/module/webpgenerator/cron?key=c2b2d28f6a271f6ce979649992e4886160a5287728117b419be61feab18519b2" >/dev/null 2>&1
  Welcome
Welcome and thank you for having purchased our module. Please read carefully the PDF documentation included with the module.
We provide detailed documentation in five different languages, to ease the configuration of the module as much as possible. If you have any questions, we are at your disposal with any information you require. Don`t hesitate to leave a rating and a comment on the module. We value your opinions and feedback. Keep an eye on the module version and check if updates are available. If you need help with updating, just contact us.