diff --git a/.htaccess b/.htaccess index 8749aefdd..5a0c61cdc 100644 --- a/.htaccess +++ b/.htaccess @@ -1,30 +1,30 @@ ## START OFFLINE.ResponsiveImages - webp-rewrite # DO NOT REMOVE THESE LINES -# -# # Vary: Accept for all the requests to jpeg and png -# SetEnvIf Request_URI "\.(jpe?g|png)$" REQUEST_image -# -# -# RewriteEngine On -# -# # If the Browser supports WebP images, and the .webp file exists, use it. -# RewriteCond %{HTTP_ACCEPT} image/webp -# RewriteCond %{REQUEST_URI} ^/?storage/.*\.(jpe?g|png) -# RewriteCond %{REQUEST_FILENAME}.webp -f -# RewriteRule ^/?(.*)$ $1.webp [NC,T=image/webp,END] -# -# # If the Browser supports WebP images, and the .webp file does not exist, generate it. -# RewriteCond %{HTTP_ACCEPT} image/webp -# RewriteCond %{REQUEST_URI} ^/?storage/.*\.(jpe?g|png) -# RewriteCond %{REQUEST_FILENAME}\.webp !-f -# RewriteRule ^/?(.*)$ plugins/offline/responsiveimages/webp.php?path=$1 [NC,END] -# -# -# Header append Vary Accept env=REQUEST_image -# -# -# AddType image/webp .webp -# + + # Vary: Accept for all the requests to jpeg and png + SetEnvIf Request_URI "\.(jpe?g|png)$" REQUEST_image + + + RewriteEngine On + + # If the Browser supports WebP images, and the .webp file exists, use it. + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{REQUEST_URI} ^/?storage/.*\.(jpe?g|png) + RewriteCond %{REQUEST_FILENAME}.webp -f + RewriteRule ^/?(.*)$ $1.webp [NC,T=image/webp,END] + + # If the Browser supports WebP images, and the .webp file does not exist, generate it. + RewriteCond %{HTTP_ACCEPT} image/webp + RewriteCond %{REQUEST_URI} ^/?storage/.*\.(jpe?g|png) + RewriteCond %{REQUEST_FILENAME}\.webp !-f + RewriteRule ^/?(.*)$ plugins/offline/responsiveimages/webp.php?path=$1 [NC,END] + + + Header append Vary Accept env=REQUEST_image + + + AddType image/webp .webp + ## END OFFLINE.ResponsiveImages - webp-rewrite