mirror of
https://github.com/phanan/htaccess.git
synced 2018-11-08 13:39:40 +01:00
Added snippet for "Serving WebP images"
This commit is contained in:
parent
c1d5886fae
commit
5a2a7927c0
1 changed files with 13 additions and 0 deletions
13
README.md
13
README.md
|
@ -425,3 +425,16 @@ AddHandler application/x-httpd-php55 .php
|
|||
# Alternatively, you can use AddType
|
||||
AddType application/x-httpd-php55 .php
|
||||
```
|
||||
|
||||
### Serve WebP images
|
||||
If WebP images are supported and an image with a .webp extension is located as the same place as the jpg/png image that is going to be served, then the WebP image is served instead.
|
||||
|
||||
``` apacheconf
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{HTTP_ACCEPT} image/webp
|
||||
RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
|
||||
RewriteRule (.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
|
||||
</IfModule>
|
||||
```
|
||||
[Source](https://github.com/vincentorback/WebP-images-with-htaccess)
|
||||
|
|
Loading…
Reference in a new issue