On Apache Httpd 2.4, I know that from a .htaccess file I can do this
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.jpg$ $1.webp [T=image/webp]
in order to implement content negotiation and for a jpg request, return a webp if the browser supports it.
Fine, I would like to send the request to Symfony when the webp file does not exists, so that a specific Symfony controller can create the webp version on demand, I know I could do this
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.jpg$ $1.webp [T=image/webp]
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp !-f
RewriteRule (.+).jpg$ index.php [PT]
but this sends to Symfony the original jpg request, is it somehow possible from .htaccess rewrite to send to Symfony the webp request instead?