Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author KeyCDN

    (@keycdn)

    Either there is a mistake in your htaccess or the page is still cached in WP.

    Btw, the Cache Enabler plugin makes it very easy to integrate WebP images.
    https://www.ads-software.com/plugins/cache-enabler/

    Thread Starter goehlert

    (@goehlert)

    “still cached”: not possible because I used Chrome private (incognito) mode
    “Mistake in htaccess”: Here is my htaccess part for WebP:
    <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]
    </IfModule>

    <IfModule mod_headers.c>
    Header append Vary Accept env=REDIRECT_accept
    </IfModule>

    AddType image/webp .webp

    Second Version for htaccess with
    RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]

    after # Serve WebP image instead…

    Both didn’t work??

    And: Cache Enabler is no Option because I already use WP Rocket (and both together doesn’t seem a good idea); Optimus HQ should work without Cache enabler …

    • This reply was modified 8 years, 6 months ago by goehlert.

    Your image path is a bit different from the default setup.

    Can you try modifying this snippet: RewriteRule ^(wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]

    to use this instead: RewriteRule ^(WP/wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]

    Thread Starter goehlert

    (@goehlert)

    Didn’t work. I made a new post (so there could be nothing old in the Cache) (https://www.bodensee-gymnasium.de/WP/fahrten/lindauer-huette/lindauer-huette-2016/alpenpflege-auf-der-lindauer-huette/) and changed my htaccess as you suggested, opened a new incognito window in Chrome, but the Content type is still image/jpeg (in the wp-content-uploads Folder, webp-images are produced in all sizes).

    Just to confirm, you are using the following snippet in your .htaccess?

    <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteCond %{HTTP_ACCEPT} image/webp
            RewriteCond %{DOCUMENT_ROOT}/$1.webp -f
            RewriteRule ^(WP/wp-content/uploads.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
    </IfModule>
    
    <IfModule mod_headers.c>
            Header append Vary Accept env=REDIRECT_accept
    </IfModule>
    
    AddType image/webp .webp

    I have replicated your setup by storing media in the WP/wp-content/uploads folder on a test site and once the change to the .htaccess snippet was made, the Content-Type was changed to image/webp. Also ensure that the snippet is added to the top of your .htaccess file.

    Have you tried disabling other plugins to verify there isn’t a third-party issue at hand?

    • This reply was modified 8 years, 6 months ago by codyarsenault.
    Thread Starter goehlert

    (@goehlert)

    Yes, I used this snippet.
    Problem is:
    https://www.bodensee-gymnasium.de is the “old” website (static html with Microsoft Expression Web, no WordPress…) which will exist until next July.
    https://www.bodensee-gymnasium.de/WP will become the new Website (made with WordPress together with my pupils) then and I try different things until then.
    – Now I tried your snippet with /WP/… in
    a).htaccess in https://www.bodensee-gymnasium.de/WP (would be twice /WP) and
    b) .htaccess in https://www.bodensee-gymnasium.de (there is also a .htaccess because of a Rewrite due to redirection to https) (of Course in case b) I deleted the snippet of a) in … /WP
    I cleared Cache with WP Rocket and opened an incognito tab in Chrome, but nothing changed.

    Plugin Author KeyCDN

    (@keycdn)

    Double check that the path (%{DOCUMENT_ROOT}) is as expected in your .htaccess file. I recommend that you focus on a single image that has a WebP version.

    Such as this image:
    https://www.bodensee-gymnasium.de/WP/wp-content/uploads/2016/09/20160720_194334.webp
    https://www.bodensee-gymnasium.de/WP/wp-content/uploads/2016/09/20160720_194334.jpg

    Again, we suggest using the Cache Enabler if you are not familiar with how to configure the .htaccess file for your requirements.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘WebP not delivered to Chrome’ is closed to new replies.