# Turn on URL rewriting
RewriteEngine On
RewriteBase /
# Protect hidden files from being viewed
<Files .*>Require all denied</Files>
RewriteCond %{REQUEST_FILENAME} !-f
# Rewrite all other URLs to index.php/URL
RewriteRule ^(.+)\.webp$ generate_webp.php?file=$1 [PT,QSA,L]
<picture>
<source srcset="image.webp" type="image/webp">
<img src="image.jpg">
</picture>
gulp.task("webp", function () { return gulp.src("source/img/**/*.{jpg,jpeg,svg}") .pipe(webp({quality: 50})) .pipe(gulp.dest("app/img")); });