• Hi,

    Do I have to import rewrite rules to iis, as I don’t see the equivalent to .htaccess files.

    For now I get this error when making a test in the admin dashboard of my multisite instance.

    Lets check that browsers supporting webp gets the WEBP when the JPEG is requested
    Making a HTTP request for the test image (pretending to be a client that supports webp, by setting the “Accept” header to “image/webp”)
    Request URL: https://blog.druet.org/wp-content/uploads/webp-express-test-images/JMkfsr.JPEG
    Response: 406 Not Acceptable
    Response headers:
    – content-type: text/html
    – server: Microsoft-IIS/10.0
    – x-powered-by: ASP.NET
    – date: Fri, 08 May 2020 22:39:34 GMT
    – content-length: 1346

    Body:
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”&gt; <html xmlns=”http://www.w3.org/1999/xhtml”&gt; <head> <meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″/> <title>406 – Client browser does not accept the MIME type of the requested page.</title> <style type=”text/css”> <!– body{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;} fieldset{padding:0 15px 10px 15px;} h1{font-size:2.4em;margin:0;color:#FFF;} h2{font-size:1.7em;margin:0;color:#CC0000;} h3{font-size:1.2em;margin:10px 0 0 0;color:#000000;} #header{width:96%;margin:0 0 0 0;padding:6px 2% 6px 2%;font-family:”trebuchet MS”, Verdana, sans-serif;color:#FFF; background-color:#555555;} #content{margin:0 0 0 2%;position:relative;} .content-container{background:#FFF;width:96%;margin-top:8px;padding:10px;position:relative;} –> </style> </head> <body> <div id=”header”><h1>Server Error</h1></div> <div id=”content”> <div class=”content-container”><fieldset> <h2>406 – Client browser does not accept the MIME type of the requested page.</h2> <h3>The page you are looking for cannot be opened by your browser because it has a file name extension that your browser does not accept.</h3> </fieldset></div> </div> </body> </html>
    The request FAILED
    The test cannot be completed
    Deleting test images

    Thank you

Viewing 1 replies (of 1 total)
  • Thread Starter olifan

    (@olifan)

    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>

Viewing 1 replies (of 1 total)

The topic ‘IIS rewrite rules’ is closed to new replies.