Created
September 27, 2023 08:33
-
-
Save sabrina-zeidan/d1e1838cab832a48f36a8489bc818def to your computer and use it in GitHub Desktop.
webp redirection on nexcess servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
# Check if the request is for a PNG or JPEG file | |
RewriteCond %{REQUEST_FILENAME} \.(png|jpe?g)$ | |
# Check if a WebP version of the file exists | |
RewriteCond %{REQUEST_FILENAME}.webp -f | |
# Redirect to the WebP version of the file | |
RewriteRule ^(.+)\.(png|jpe?g)$ $1.$2.webp [NC,L] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment