Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter olifan

    (@olifan)

    just noticed a small error in the last sentence:

    <action type=”Rewrite” url=”wp-content/uploads-webpc/sites/{R:1}/{R:2}/{R:3}/{R:4}.jpeg.webp” appendQueryString=”true” logRewrittenUrl=”false” />
    </rule>

    jpeg and not jpg of course (wrong paste).

    Now I owe you some pints of beers ??

    Thread Starter olifan

    (@olifan)

    Hi,

    I finaly managed to make it work in IIS, using a module for analysis failed requests (which gives the effective rewrite results).

    I didn’t use the upload .htacces files, which merely seems to allow webp (I have the plugin WP Enable WebP installed).

    Here are the 2 rules of my web.config file.
    It is purposely filtered for the 1sec blog, as I don’t wan’t yet to convert the others. Maybe not optimized but at least working !

    <rule name=”1sec JPG vers WEBP” enabled=”true” stopProcessing=”true”>
    <match url=”^1sec/wp-content/uploads/sites/([0-9]+)/([0-9]+)/([0-9]+)/([_0-9a-z-]+).(jpg)$” />
    <conditions logicalGrouping=”MatchAll” trackAllCaptures=”false”>
    <add input=”{HTTP_ACCEPT}” pattern=”image/webp” />
    </conditions>
    <action type=”Rewrite” url=”wp-content/uploads-webpc/sites/{R:1}/{R:2}/{R:3}/{R:4}.jpg.webp” appendQueryString=”true” logRewrittenUrl=”false” />
    </rule>
    <rule name=”1sec JPEG vers WEBP” enabled=”true” stopProcessing=”true”>
    <match url=”^1sec/wp-content/uploads/sites/([0-9]+)/([0-9]+)/([0-9]+)/([_0-9a-z-]+).(jpeg)$” />
    <conditions logicalGrouping=”MatchAll” trackAllCaptures=”false”>
    <add input=”{HTTP_ACCEPT}” pattern=”image/webp” />
    </conditions>
    <action type=”Rewrite” url=”wp-content/uploads-webpc/sites/{R:1}/{R:2}/{R:3}/{R:4}.jpg.webp” appendQueryString=”true” logRewrittenUrl=”false” />
    </rule>

    Thread Starter olifan

    (@olifan)

    This is a self hosted instance; I am the boss ??
    I will try to import rules.

    Thread Starter olifan

    (@olifan)

    I understand that .htaccess files are not managed by IIS.
    I have the url rewrite module V2 installed.
    Should I import some rules ?

    Thread Starter olifan

    (@olifan)

    Hi, you can check this test page which was loaded with JPEG anf your plugin:
    https://blog.druet.org/1sec/2020/05/09/530/

    Rest of the site is not yet converted.

    Thread Starter olifan

    (@olifan)

    # BEGIN WebP Converter
    # ! — DO NOT EDIT PREVIOUS LINE — !
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f
    RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.webp [NC,T=image/webp,E=cache-control:private,L]
    RewriteCond %{HTTP_ACCEPT} image/webp
    RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f
    RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,E=cache-control:private,L]
    </IfModule>
    # ! — DO NOT EDIT NEXT LINE — !
    # END WebP Converter

    Thread Starter olifan

    (@olifan)

    I did not mention that I cleared the cache, and tested on both Firefox and Edge.
    Tested on an article, but also on a gallery embeded into a portfolio from theme Timber Lite.

    Thread Starter olifan

    (@olifan)

    Hi,

    I checked the FAP, and the network -> img debug page on browser.
    Images type remains jpeg and not webp.

    I tried with another image from the start, image is correctly loaded here:
    “C:\inetpub\wwwroot\wp-content\uploads\sites\6\2020\05\1sec-_MG_1887_DxO.jpg”

    and converted here:
    “C:\inetpub\wwwroot\wp-content\uploads-webpc\sites\6\2020\05\1sec-_MG_1887_DxO.jpg.webp”

    but the page where it is displayed seems still jpeg, confirmed by the object size (2.9 Mo for jpeg and only 688ko for webp).

    Could it be that folder location changes on multisites, as you FAQ gives a different path : /wp-content/uploads-webpc/2019/06/example.jpg.webp.

    Multisites involved a site # before the year.

    Thank you

    Thread Starter olifan

    (@olifan)

    Hi,

    Thank you very much for this update !
    Installation works fine and I can now access the settings from individual blog.

    I can see that uploads trigger webp thumbnails (for example on : C:\inetpub\wwwroot\wp-content\uploads-webpc\sites\6\2020\05)

    How to check this is the webp version which is used, as I can still see the jpeg link on the page source behind the picture.

    But the source contents shows this script point at a webp file:

    var loaderRandomImages = [“https:\/\/blog.druet.org\/1sec\/wp-content\/uploads\/sites\/6\/2020\/04\/1sec-_MG_9381_DxOm.webp”];

    Do you confirm that there are no web server rewrite rules as I am running on IIS, which would mean some manual settings.

    Thank you

    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>

    Hi have you been able to solve this issue, as I am ready to switch to another plugin unfortunately..
    Thanks

Viewing 11 replies - 1 through 11 (of 11 total)