Skip to content

Instantly share code, notes, and snippets.

@amElnagdy
Created May 31, 2016 18:44
Show Gist options
  • Save amElnagdy/bfc0844a869cb4561764f683ced1a68b to your computer and use it in GitHub Desktop.
Save amElnagdy/bfc0844a869cb4561764f683ced1a68b to your computer and use it in GitHub Desktop.
# http config block
map $http_accept $webp_ext {
default "";
"~*webp" ".webp";
}
# server config block
location ~* ^/wp-content/.+\.(png|jpg)$ {
add_header Vary Accept;
try_files $uri$webp_ext $uri =404;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment