title: How to serve webp images using htaccess?
body: <p>I would like to serve .webp images if the image (jpg or png) is available as webp. If not I want to show the jpg or png.</p>
  
  <pre><code>RewriteCond %{HTTP_ACCEPT} image/webp
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^(.*)\.(jpe?g|png)(.*)$ $1.$2.webp [NC,L]
  
  AddType image/webp .webp
  </code></pre>
  
  <p>The problem I need the final URL to be like: </p>
  
  <pre><code>"myurl.com/foo.jpg.webp" 
  </code></pre>
  
  <p>If the webp file exists and if not I need: </p>
  
  <pre><code>"myurl.com/foo.jpg"
  </code></pre>
  
  <p>as a fallback solution.</p>