I can't figure out why my htaccess won't rewrite urls to webp images, only images that are on skin directory get served as webp.

https://domain/skin/frontend/theme/test/images/image.png will be served as webp image from https://domain/skin/frontend/theme/test/images/image.webp

If it is a wysiwyg image in /media/wysiwyg/ directory it won't be serverd as webp..

https://domain/media/wysiwyg/pags/images/en_image02_2x.jpg however exactly as skins directory there is webp image with same file name....

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{HTTP_ACCEPT} image/webp
   RewriteCond %{REQUEST_URI} (?i)(.*)(\.jpe?g|\.png)$
   RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
   RewriteRule (.+)\.(jpe?g|png)$ $1.webp [L,T=image/webp,R]

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

<IfModule mod_mime.c>
     AddType image/webp .webp

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.