Last active
September 20, 2020 17:02
-
-
Save ceer/8362c0319e2f4e34b4fe9caa2e2e42a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# serve webp for compatible browser | |
RewriteCond %{HTTP_ACCEPT} image/webp | |
RewriteCond %{REQUEST_URI} (?i)(.*)(\.jpe?g|\.png)$ | |
RewriteCond %{DOCUMENT_ROOT}%1.webp -f | |
RewriteRule (?i)(.*)(\.jpe?g|\.png)$ %1\.webp [L,T=image/webp,R] | |
Header append Vary Accept env=REDIRECT_accept | |
AddType image/webp .webp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment