plugin-icon

SEV Rewrite-Free WebP for W3TC

Автор: Heinrich Franz·
Replaces image URLs with WebP versions when supported and available through W3 Total Cache ImageService.
Версия
2.0.0
Последние изменения
Jul 24, 2026

SEV Rewrite-Free WebP for W3TC — это легкий плагин-компаньон для W3 Total Cache, который автоматически обслуживает изображения WebP для браузеров, поддерживающих их.

Unlike traditional WebP delivery methods, this plugin does not rely on Apache or Nginx rewrite rules. No changes to .htaccess, mod_rewrite, or web server configuration are required. Instead, it rewrites image URLs directly in the generated HTML before the page is sent to the visitor.

This makes the plugin particularly useful on managed hosting environments, including many Plesk installations, where configuring or relying on web server rewrite rules is difficult, restricted, or simply not practical. If W3 Total Cache ImageService has already generated a WebP version of an image, this plugin serves it without requiring any server-side rewrite configuration.

Это независимое, неофициальное дополнение, не связанное, не одобренное и не спонсируемое BoldGrid / W3 EDGE, создателями W3 Total Cache. «W3 Total Cache» является торговой маркой соответствующего владельца и используется здесь только для описания совместимости.

Features

  • No Apache or Nginx rewrite rules required.
  • No .htaccess modifications.
  • Automatically detects WebP support via the browser’s Accept header.
  • Rewrites image URLs only when a corresponding WebP image exists.
  • Supports src, srcset, data-src, and data-srcset attributes.
  • Sends a Vary: Accept header for correct browser, CDN, and proxy caching.
  • Extends the W3 Total Cache page cache key so WebP and non-WebP pages are cached separately.
  • Lightweight and requires no configuration.

Принцип работы:

  1. A visitor requests a page.
  2. The plugin checks the HTTP Accept header to determine whether the browser supports WebP.
  3. It scans the post content for image URLs (src, srcset, data-src, and data-srcset).
  4. For each image, it checks whether W3 Total Cache ImageService has already generated a WebP version.
  5. If a WebP image exists, the corresponding URL in the generated HTML is replaced with the .webp URL.
  6. Отправляется заголовок ответа Vary: Accept, чтобы CDN и обратные прокси-серверы кэшировали версии WebP и не-WebP отдельно.
  7. The W3 Total Cache page cache key is extended with :webp or :no-webp, ensuring W3 Total Cache stores separate cached pages for browsers with and without WebP support.

Требования:

  • W3 Total Cache должен быть установлен и активен.
  • Images must have been converted using Media W3TC Image Service.

Limitations

This plugin does not convert images to WebP. Image conversion is handled entirely by W3 Total Cache ImageService. If no WebP version exists for an image, the original image URL remains unchanged.

Проверено на
WordPress 7.1
Этот плагин можно скачать и использовать при .