I added AVIFs support for Flying Press Caching Plugin

[ad_1]

As caching plugins like WP Rocket and Flying Press, possible others only checking WebP support, and push only WebP (if supported).
So my rewrite now is doing to push generated AVIFs for my client when browser supports that:

# Rewrite AVIFs
<IfModule mod_rewrite.c>
RewriteEngine On
# Check if AVIF is supported by the browser
RewriteCond %{HTTP_ACCEPT} image/avif
# Check if the .avif file exists
RewriteCond %{DOCUMENT_ROOT}/$1.avif -f
# Serve the .avif file content for the .webp request
RewriteRule ^(wp-content/uploads/.+)\.webp$ $1.avif [T=image/avif,E=accept:avif,L]
</IfModule>
# Rewrite AVIFs END

You can safely add that into your plugin, that rewrite is working in main WordPress folder.

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer