This commit is contained in:
merdan 2021-04-15 15:38:38 +05:00
parent 00a65f5e68
commit 1ad903e92c
1 changed files with 25 additions and 25 deletions

View File

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