WebP rules not writing to .htaccess
-
Hi there,
I was having some trouble getting my site to serve WebP converted images and realised the # BEGIN W3TC WEBP section was missing from my .htaccess file. After manually adding the below to .htaccess it seems to be working perfectly:
# BEGIN W3TC WEBP <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} (.+)\.(jpe?g|png|gif)$ RewriteCond %1\.webp -f RewriteCond %{QUERY_STRING} !type=original RewriteRule (.+)\.(jpe?g|png|gif)$ $1.webp [NC,T=image/webp,E=webp,L] </IfModule> <IfModule mod_headers.c> <FilesMatch "\.(jpe?g|png|gif)$"> Header append Vary Accept </FilesMatch> </IfModule> AddType image/webp .webp # END W3TC WEBP
Strangely, the # BEGIN W3TC Page Cache core rules were automatically generated but not the above rules. Just wondering if I’m missing something here – is there a setting that generates the WebP rules automatically? And is there a risk of the manually added WebP rules being overwritten when I update the plugin settings?
Cheers,
Peter
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WebP rules not writing to .htaccess’ is closed to new replies.