Easy way to create a fallback for Webp images

[ad_1]

So we have been using WebP images everywhere. However, our audience is older and I’m sure some are being stubborn and not updating their browsers. We had one customer complain.

​

What is a simply way to create a fallback for WebP images if the browser is older? I’d prefer not a plugin and do something manually. But I’m open to a light weight plugin too.

[ad_2]
2 Comments
  1. Do you have access to edit .htaccess? If so,

    `<IfModule mod_rewrite.c>`

    `RewriteEngine On`

    `# Check if browser supports WebP images`

    `RewriteCond %{HTTP_ACCEPT} image/webp`

    `# Check if WebP replacement image exists`

    `RewriteCond %{DOCUMENT_ROOT}/$1.webp -f`

    `# Serve WebP image instead`

    `RewriteRule (.+).(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]`

    `# Set WebP header if WebP image was served`

    `Header append Vary Accept env=REDIRECT_accept`

    `</IfModule>`

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer