Hello –
The theme I’m using has the ability to display images in webp format as opposed to jpeg or png. Since I don’t want the theme to write directly to the .htaccess file, where would I place the custom code within the .htaccess code editor? Below is the code:
<IfModule mod_rewrite.c>
RewriteEngine On
# serves a .webp image instead of jpg/png
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} ^(.+)\.(jpe?g|jpg|png)$
RewriteCond %1\.webp -f
RewriteRule ^(.+)\.(jpe?g|jpg|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
<IfModule mod_headers.c>
Header append Vary Accept env=REQUEST_image
</IfModule>
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>