Jpeg to WebP over htaccess

#1
Hello how can i convert this htaccess code for use in OLS?

# Check if browser support WebP images
RewriteCond %{HTTP_ACCEPT} image/webp

# Check if WebP replacement image exists
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f

# Serve WebP image instead
RewriteRule (.+)\.(jpe?g)$ $1.webp [T=image/webp,E=accept:1]

<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp
 

Pong

Administrator
#2
For:
<IfModule mod_headers.c>
Header append Vary Accept env=REDIRECT_accept
</IfModule>

AddType image/webp .webp
they are not rewrite rules and not supported by OLS. OLS only support rewrite rule in .htaccess.

For the rest rewrite rules, you can simple place them in .htaccess, then restart OLS. If they did not work as espected, you can test them on apache to make sure they are working fine, or turn on rewrite log to check how it breaks.
 
Top