Skip to content

Commit

Permalink
Added AVIF in .htaccess example
Browse files Browse the repository at this point in the history
  • Loading branch information
vHeemstra authored Feb 14, 2024
1 parent 34acb7c commit d4a9c52
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,23 @@ Use [**skipIfLargerThan**](#makeskipiflargerthan) option to ensure additional ve
# ...serve WebP image instead of jpeg/png/gif.
RewriteRule (.+)\.(jpe?g|png|gif)$ $1.webp [T=image/webp,E=REQUEST_image]
# Same for AVIF
RewriteCond %{HTTP_ACCEPT} image/avif
RewriteCond %{REQUEST_FILENAME}.avif -f
RewriteRule (.+)\.(jpe?g|png|gif)$ $1.avif [T=image/avif,E=REQUEST_image]
</IfModule>
<IfModule mod_headers.c>
# Vary: Accept for all the requests to jpeg, png and gif
# Tell the browser the response (for this image) varies
# depending on the "Accept" request header.
Header append Vary Accept env=REQUEST_image
</IfModule>
<IfModule mod_mime.c>
# Add file type MIME support
AddType image/webp .webp
AddType image/avif .avif
</IfModule>
```
_Adopted from answers given [here](https://stackoverflow.com/a/68967381/2142071)._
Expand Down

0 comments on commit d4a9c52

Please sign in to comment.