• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Issue .htaccess rule ignored if file exists

yehudigt

Basic Pleskian
I'm trying to add webp support to mys ite but it seems that if my not webp file exists the .htaccess rule is being ignored.

System is
  • ‪CentOS Linux 7.7.1908 (Core)‬
  • Plesk Onyx 17.8.11 Aggiorna #73
Using Nginx + apache / static files served through nginx but not images

This is my .htaccess part involved

RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp]

Both thes files exists:

But according to the previous rule I should always seee the webp if my browser supports it.

The strange thing is that if I browse a rewrited url like this one:

Which is this physical url
https://www.magazzinirossi.it/img/p/6/7/9/0/7/67907-large_default.jpg

I see the webp image.

If I try the physical file directly it serves me the jpg instead of the webp although there is the rule in .htaccess.

Can anyone explain me how can this happen?

Thanks
 
In the default configuration the .jpg file is served by Nginx, because it is static content. Such requests never reach Apache, for that reason an .htaccess rule that is meant to rewrite an URL ending on .jpg will never be executed.
 
Thank you Peter,
but as I said static files are served through nginx but not images: all the extensions related to images have been removed from the textarea, so they should be passed to apache (acccording to Plesk documentation). Screenshot attached. The only way to make it work is to unselect the intelligent processing of static files, which means that although those fiels should be passed to apache they are not. Maybe this is a Plesk bug...
 

Attachments

  • Schermata 2020-04-07 alle 15.52.27.png
    Schermata 2020-04-07 alle 15.52.27.png
    206.8 KB · Views: 7
Back
Top