Jump to content

webp htaccess rewrite


OHP22
 Share

Recommended Posts

Hi,

i have implemented htaccess rewrite to our htaccess within section 8.

i've followed this instructions and used method 2:
https://processwire.com/blog/posts/webp-images-and-more/

I also added a hook to ready.php. The webp format is created and i can hardcode it into our main file. but our htaccess doesnt rewrite the url from png,jpg to webp?

Does anyone have an idea?

 

Link to comment
Share on other sites

On 2/16/2023 at 11:19 PM, OHP22 said:

but our htaccess doesnt rewrite the url from png,jpg to webp?

With method 2 htaccess should rewrite it from webp to jpg shouldn't it?

Assuming that is what you're expecting it to do, I found the example htaccess code didn't work for me. But I found that the code below did work (of course YMMV).

RewriteCond %{HTTP_ACCEPT} !image/webp
RewriteRule (.+)\.webp$ $1.jpg [T=image/jpeg,E=REQUEST_image]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...