Advertisement
illbrych

webp express NGINX rules

Sep 21st, 2021
1,311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nginx 0.64 KB | None | 0 0
  1. # WebP Express rules
  2. # ——————–
  3. location ~* ^/?wp-content/.*.(png|jpe?g)$ {
  4. add_header Vary Accept;
  5. expires 365d;
  6. if ($http_accept !~* "webp"){
  7. break;
  8. }
  9. try_files
  10. /wp-content/webp-express/webp-images/doc-root/$uri.webp
  11. $uri.webp
  12. /wp-content/plugins/webp-express/wod/webp-on-demand.php?xsource=x$request_filename&wp-content=wp-content
  13. ;
  14. }# Route requests for non-existing webps to the converter
  15. location ~* ^/?wp-content/.*.(png|jpe?g).webp$ {
  16. try_files
  17. $uri
  18. /wp-content/plugins/webp-express/wod/webp-realizer.php?xdestination=x$request_filename&wp-content=wp-content
  19. ;
  20. }
  21. # ——————- (WebP Express rules ends here)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement