I've tried this for example:
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/storage/app/public/images/.jpg.webp -f
RewriteCond %{HTTP_HOST}@@%{HTTP_REFERER} ^([^@]*)@@https?:///.*
RewriteRule (.+)\.jpg$ /storage/images/.jpg.webp [NC,T=image/webp,E=cache-control:no-cache,L]
That's right, I want the webp version of image.jpg. With htaccess you can rewirte that. I copied that from a wordpress plugin called webp-express.
The htaccess of the uploads folder in wordpress is:
# Redirect to existing converted image in cache-dir (if browser supports webp)
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} (?i)(/home/site/domains/site.nl/public_html/wp-content/uploads/)(.*)(\.jpe?g|\.png)$
RewriteCond /home/site/domains/site.nl/public_html/wp-content/webp-express/webp-images/uploads/%2%3.webp -f
RewriteRule (?i)(.*)(\.jpe?g|\.png)$ /wp-content/webp-express/webp-images/uploads/%2%3\.webp [T=image/webp,E=EXISTING:1,E=ADDVARY:1,L]
This plugin creates a webp-express folder in the wp-content folder and adds the webp files in this folder (organised by year, as wordpress does too).
I hope you can follow my example!