Answer the question
In order to leave comments, you need to log in
Why does the rule in .htaccess not work?
Good afternoon.
Please tell me why the redirect to webp does not work if you do this:
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(jpg|png)$
RewriteCond %1\.webp -f
RewriteRule (.+)\.(jpg|png)$ $1.webp [T=image/webp,E=REQUEST_image]
Header append Vary Accept env=REDIRECT_accept
AddType image/webp .webp
<img src="pic.jpg">
then go to site.ru/test/ test.html everything will work, the webp image will be displayed in a browser with support. But for some reason it doesn't work like this on a live site, a jpg image is always displayed. The path to the image is this: https://site.ru/img/item/5/1-small.jpgRewriteCond %{REQUEST_URI} (.*)\.(jpg|png)$
RewriteCond %{DOCUMENT_ROOT}%1\.webp -f
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question