This is what I created, it is a bit more accurate than the previous
rule as it detects for the exact mime type assumed image/webp however
It could be image/x-webp it also ensures that the file exists. I have
tested it and it works in my current environment I hope it helps as a
starting point.
<IfModule mod_rewrite.c>
# Enable rewrite
RewriteEngine On
# Does browser support WebP?
RewriteCond %{HTTP_ACCEPT} \bimage/webp\b
# Capture image name
RewriteCond %{REQUEST_URI} (.*)\.jpe?g$
# Does WebP image exist?
RewriteCond %{DOCUMENT_ROOT}%1.webp -f
# Route to WebP image
RewriteRule .* %1\.webp [L]
</IfModule>
If anyone has any improvements or suggestions please let me know.
On Oct 1, 4:45 am, Rich Bradshaw <
rich.brads...@gmail.com> wrote:
> Assumedly the best way to use webp will be to set apache to check the
> Accept header for the image/webpmimetype and then serve up a jpg if