• Resolved shembelcut

    (@shembelcut)


    Hi,

    Thanks a lot for your great work.
    I can see the files are being generated under “uploads-webpc” directory however when I’m fetching my content from rest api “wp-json/wp/v2/posts/1?_embed” I don’t see any webp file being delivered.
    Am I missing something ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Hello @shembelcut,

    Thanks for your message.

    Did you read the FAQ plugin before you wrote to me?

    Best,
    Mateusz

    Thread Starter shembelcut

    (@shembelcut)

    Hello @mateuszgbiorczyk,

    Thanks for your response.
    Actually I followed all the steps in FAQ, I tried using both ngnix and apache for my website and it both scenarios I can’t get the redirects working via “via .htaccess (recommended)” option.
    However if I change the setting to “Pass Thru (without rewrites in .htacces files or Nginx configuration)” I can see that my browser is fetching the webp format but then all the images in REST API responses are still jpg and png format.

    I doubled checked the following files:
    – /wp-content/.htaccess
    – /wp-content/uploads/.htaccess
    – /wp-content/uploads-webpc/.htaccess
    and they are not empty:

    # BEGIN WebP Converter
    # ! --- DO NOT EDIT PREVIOUS LINE --- !
    <IfModule mod_mime.c>
      AddType image/webp .webp
    </IfModule>
    <IfModule mod_expires.c>
      ExpiresActive On
      ExpiresByType image/webp "access plus 1 year"
    </IfModule>
    # ! --- DO NOT EDIT NEXT LINE --- !
    # END WebP Converter
    

    also I have added following rule as an additional nginx directives :

    location ~ /wp-content/(?<path>.+)\.(?<ext>jpe?g|png|gif)$ {
    	if ($http_accept !~* "image/webp") {
    		break;
    	}
    	add_header Vary Accept;
    	expires 365d;
    	try_files /wp-content/uploads-webpc/$path.$ext.webp $uri =404;
    }
    

    Also I tried serving assets files directly by nginx as well as apache.
    so basically I tried pretty much all the scenarios but seems like something is not right on my VPS.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    @shembelcut Please give me your website URL.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How do I get the webp urls in rest’ is closed to new replies.