Code in htacces works on everything but images(the only thing that it needs to redirect). Using Cloudways and Prestashop . It work on local with Mamp
I have tried making it redirect averything(removing conditions) and it makes everything redirect( making it a php error as its not an image) but images are still not being redirected.
# Redirect images to webp-on-demand.php (if browser supports webp)
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)\.(jpe?g|png)$ webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,L]
I tried
# Redirect images to webp-on-demand.php (if browser supports webp)
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME}
RewriteRule webp-on-demand.php?source=%{SCRIPT_FILENAME} [NC,L]
which results in error on everything but images ( they return itself instead of compression result)
http://dev-cz.mamalabels.com/webp-on-demand.php?source=img/att/183/222-cs.png url with script https://dev-cz.mamalabels.com/img/att/183/222-cs.png url of image
Image should return a page where script says how it got compressed (later returns a webp image) but it just keeps returning itself