Check out the Pastebin Gadgets Shop. We have thousands of fun, geeky & affordable gadgets on sale :-)Want more features on Pastebin? Sign Up, it's FREE!

WebP htaccess optimization

By: smenardpw on Apr 19th, 2013  |  syntax: Apache Log  |  size: 0.41 KB  |  views: 686  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print  |  QR code  |  clone
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Check if Accept header is image/webp, if an image is requested in "classic" folder with a classic format, and check if the corresponding webp image exists. If yes, rewrite the requested classic image URI to the WebP image URI.
  3. RewriteCond %{HTTP_ACCEPT} image/webp
  4. RewriteCond %{REQUEST_FILENAME} (.*)images/classic/(.*)\.(png|jpg|gif)$
  5. RewriteCond %1images/webp/%2\.webp -f
  6. RewriteRule .* images/webp/%2.webp [L]
clone this paste RAW Paste Data