Answers for "Serve images in nextgen formats wordpress"

0

Serve images in nextgen formats wordpress

<IfModule mod_setenvif.c>
  # Vary: Accept for all the requests to jpeg and png
  SetEnvIf Request_URI "\.(jpe?g|png)$" REQUEST_image
</IfModule>

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Check if browser supports WebP images
  RewriteCond%{HTTP_ACCEPT}image/webp

  # Check if WebP replacement image exists
  RewriteCond%{DOCUMENT_ROOT}/$1.webp-f

  # Serve WebP image instead
  RewriteRule(.+)\.(jpe?g|png)$$1.webp[T=image/webp]
</IfModule>

<IfModule mod_headers.c>
  Header append Vary Accept env=REQUEST_image
</IfModule>

<IfModule mod_mime.c>
  AddType image/webp .webp
</IfModule>
Posted by: Guest on December-28-2020

Code answers related to "Serve images in nextgen formats wordpress"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language