Hello, tried to upload rewrite rule in IIS, but this one is failing from
C:\inetpub\wwwroot/wp-content/uploads/.htaccess
T=image/webp,E=EXISTING:1
I didn’t manage to have the previous test working so far..
Any help appreciated about iis support !
Thank you
——————————————————————-
Here my system info details:
System info:
– PHP version: 7.3.5
– OS: WINNT
– Server software: Microsoft-IIS/10.0
– Document Root status: Available and its “realpath” is available too. Can be used for structuring cache dir.
– Document Root: C:\\inetpub\\wwwroot
– Document Root (symlinked resolved): C:\inetpub\wwwroot
– Document Root: Available and its “realpath” is available too. Can be used for structuring cache dir.
– Apache module “mod_rewrite” enabled?: could not be determined
– Apache module “mod_headers” enabled?: could not be determined
Wordpress info:
– Version: 5.4.1
– Multisite?: yes
– Is wp-content moved?: no
– Is uploads moved out of wp-content?: no
– Is plugins moved out of wp-content?: no
Image roots (absolute paths)
uploads: C:\inetpub\wwwroot/wp-content/uploads (resolved for symlinks: C:\inetpub\wwwroot\wp-content\uploads)
themes: C:\inetpub\wwwroot/wp-content/themes (resolved for symlinks: C:\inetpub\wwwroot\wp-content\themes)
plugins: C:\inetpub\wwwroot/wp-content/plugins (resolved for symlinks: C:\inetpub\wwwroot\wp-content\plugins)
wp-content: C:\inetpub\wwwroot/wp-content (resolved for symlinks: C:\inetpub\wwwroot\wp-content)
index: C:\inetpub\wwwroot
Image roots (relative to document root)
uploads: wp-content/uploads
themes: wp-content/themes
plugins: wp-content/plugins
wp-content: wp-content
index: .
Image roots (URLs)
uploads: https://blog.druet.org/wp-content/uploads
themes: https://blog.druet.org/wp-content/themes
plugins: https://blog.druet.org/wp-content/plugins
wp-content: https://blog.druet.org/wp-content
index: https://blog.druet.org
WebP Express configuration info:
– Destination folder: separate
– Destination extension: append
– Destination structure: doc-root
(To view all configuration, take a look at the config file, which is stored in C:\inetpub\wwwroot/wp-content/webp-express/config/config.json)
Live tests of .htaccess capabilities:
– mod_rewrite working?: no
– mod_header working?: no
– passing variables from .htaccess to PHP script through environment variable working?: no
.htaccess files that WebP Express have placed rules in the following files:
– C:\inetpub\wwwroot/wp-content/uploads/.htaccess
– C:\inetpub\wwwroot/wp-content/webp-express/webp-images/.htaccess
WebP rules in uploads:
# Rules for handling requests for source images
# ———————————————
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect to existing converted image in cache-dir (if browser supports webp)
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{DOCUMENT_ROOT}/wp-content/webp-express/webp-images/doc-root/wp-content/uploads/$1.$2.webp -f
RewriteRule ^/?(.+)\.(jpe?g)$ /wp-content/webp-express/webp-images/doc-root/wp-content/uploads/$1.$2.webp [NC,T=image/webp,E=EXISTING:1,L]
# Redirect images to webp-on-demand.php (if browser supports webp)
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^/?(.+)\.(jpe?g)$ /wp-content/plugins/webp-express/wod/webp-on-demand.php?xsource-rel=xwp-content/uploads/$1.$2&wp-content=wp-content [NC,L]
# Make sure that browsers which does not support webp also gets the Vary:Accept header
# when requesting images that would be redirected to webp on browsers that does.
<IfModule mod_headers.c>
<FilesMatch “(?i)\.(jpe?g|png)$”>
Header append “Vary” “Accept”
</FilesMatch>
</IfModule>
</IfModule>
WebP rules in cache:
# Rules for handling requests for webp images
# ———————————————
# WebP Realizer: Redirect non-existing webp images to webp-realizer.php, which will locate corresponding jpg/png,
# convert it, and deliver the freshly converted webp
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/?(.+)\.(webp)$ /wp-content/plugins/webp-express/wod/webp-realizer.php?xdestination-rel=xwp-content/webp-express/webp-images/$1.$2&wp-content=wp-content [NC,L]
</IfModule>
# Set Vary:Accept header if we came here by way of our redirect, which set the ADDVARY environment variable
# The purpose is to make proxies and CDNs aware that the response varies with the Accept header
<IfModule mod_headers.c>
<IfModule mod_setenvif.c>
# Apache appends “REDIRECT_” in front of the environment variables defined in mod_rewrite, but LiteSpeed does not
# So, the next lines are for Apache, in order to set environment variables without “REDIRECT_”
SetEnvIf REDIRECT_EXISTING 1 EXISTING=1
SetEnvIf REDIRECT_ADDVARY 1 ADDVARY=1
Header append “Vary” “Accept” env=ADDVARY
# Set X-WebP-Express header for diagnose purposes
Header set “X-WebP-Express” “Redirected directly to existing webp” env=EXISTING
</IfModule>
</IfModule>
# Register webp mime type
<IfModule mod_mime.c>
AddType image/webp .webp
</IfModule>