1

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

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119
  • The default .htaccess of prestashop comes with a lot of rewrite rules already, quite a lot of them dealing with images. Where did you place your own attempts as shown here in relation to what already exists? – misorude Aug 22 '19 at 11:15
  • Above all code. (Ofc I have Rewrite engine on before) . I have it working on local but for some reason when i try to deploy it it wont work on server . – Martin Ouředník Aug 22 '19 at 11:18

0 Answers0