• Resolved cooltronic

    (@cooltronic)


    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]

Viewing 1 replies (of 1 total)
  • Thread Starter cooltronic

    (@cooltronic)

    # Rewrite AVIFs
    <IfModule mod_headers.c>
      <filesMatch "\.(webp|avif)$">
        Header set Cache-Control "max-age=31536000, public"
      </filesMatch>
    </IfModule>
    <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
Viewing 1 replies (of 1 total)
  • The topic ‘I added AVIFs support for Flying Press Caching Plugin’ is closed to new replies.