• Resolved aicas

    (@aicas)


    Hello,

    the plugin creates the WebP files, but it does not change the .htaccess file, so there are no rules to serve the WebP files.

    Can you force the htaccess rewrite or is there a file that contains the rules?

    Thanks

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

    (@mateuszgbiorczyk)

    Hi @aicas,

    Thank you for your message.

    What .htaccess file is not updated? Please describe your case carefully.

    Thread Starter aicas

    (@aicas)

    I checked the .htaccess files in the root directory, wp directory and wp-content directory. None contained any lines from the plugin and had not been updated recently.

    As far as I understand one of those should have been updated to include redirect rules?

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Tell me please, did you read the plugin FAQ? Please appreciate your and my time. I will be very grateful for that.

    If you need technical support, please read it and give me all the information I need in the FAQ. There is a dedicated question there.

    Thread Starter aicas

    (@aicas)

    I did read the plugin FAQ and did not find out, where the htaccess file modified by Webpc was supposed to be.

    Now I found it. It was at /wp/wp-content/uploads and contained following rules

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

    The thing is, this still does not replace the original files with webp files, although the webp files are available (I did regenerate existing images) and can manually load the webp files in the browser, when I enter the URL.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    I will repeat again.

    If you need technical support, please read it and give me all the information I need in the FAQ. There is a dedicated question there.

    Thread Starter aicas

    (@aicas)

    Hi Matesuz,

    Sorry for the delay and misunderstanding. Please find answers to all questions in the FAQ.

    1. Do you have any error on the plugin settings page?
    – No

    2. URL of your website
    https://www.aicas.com

    3. Does your server meet the technical requirements described in the FAQ?
    – As far as I can see, it should meet the requirement. https://www.aicas.com/wp/wp-content/uploads/2020/06/aicas-server-config-webpc.png

    4. Do you use CDN?
    – No

    5. Check if in /wp-content/uploads-webpc directory are all files that should be converted.
    – All converted files, that are smaller than the original are there.

    6. If in the previous step it turned out that you have files, please do the test.
    https://www.aicas.com/wp/wp-content/uploads/2020/06/devtools-screenshot.png
    (for https://www.aicas.com/wp/segments/agriculture/)

    7. Content of your .htaccess files from directories /wp-content, /wp-content/uploads and /wp-content/uploads-webpc

    wp-content:
    Empty File

    wp-content/uploads:

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

    wp-content/uploads-webpc:

    # 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

    8. Do you use any plugin filters or actions from this FAQ?
    – No, did not add any filters or actions manually.

    9. What plugin version are you using?
    – Version 1.3.0

    10. Used WordPress version?
    – Version 5.4.2

    11. A list of all the plugins you use.
    (Have not deactivated and reverted to default theme, because the site is already live)

    Advanced Custom Fields
    Autoptimize
    Content Box Addon For Elementor
    Custom Post Type UI
    Custom Scripts for Customizer
    Debug Bar
    Elementor
    Elementor Addon Elements
    Elementor Pro
    Enable Media Replace
    Essential Addons for Elementor
    Export Media Library
    GDPR Cookie Compliance
    Gravity Forms
    Gravity Forms – SuiteCRM Integration
    Modern Events Calendar Lite
    Multiple Columns for Gravity Forms
    Premium Addons for Elementor
    Simple Job Board
    SVG Support
    The GDPR Framework
    User Role Editor
    W3 Total Cache
    WebP Converter for Media
    WP Floating Menu
    WP Meta SEO
    WP Reset

    When testing, I did flush all caches of Autoptimize and W3 Total Cache and deleted local browser cache.

    • This reply was modified 4 years, 9 months ago by aicas.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Thank you so much for all the information! Can you tell what the value of $_SERVER['DOCUMENT_ROOT'] is on your server?

    Thread Starter aicas

    (@aicas)

    Document Root is:
    /kunden/homepages/17/d33475532/htdocs

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    It seems that this variable is indicating the wrong value. Can you show the entire contents of the $_SERVER variable?

    Could you edit the .htaccess file from the /uploads directory? Paste the following code there:

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

    This is a temporary solution. Did it help?

    Thread Starter aicas

    (@aicas)

    Mateusz,

    I really appreciate your help and fast response. I did copy the code to the htaccess in the wp-content/upload directory, but replacement is still not working. I even deactivated Autoptimize and W3 Cache (and flushed caches and local browser data).

    To see the content of the Server variable I created a short script.
    https://www.aicas.com/wp/wp-content/path.php

    mod_rewrite, mod_mime and mod_expire are installed according to our sys admin and your example is working, too.
    https://www.aicas.com/wp/wp-content/plugins/webp-converter-for-media/public/img/icon-before.png

    Another interesting thing. I created two test images of my own.

    https://aicas.com/wp/wp-content/uploads/2020/12/shutterstock_1053687887-scaled.jpg
    Shows the original image, but when I change the path

    https://aicas.com/wp/wp-content/uploads-webpc/uploads/2020/12/shutterstock_1053687887-scaled.jpg
    it replaces the image with the (different Webp) without changing the file extension. The way it should work.

    • This reply was modified 4 years, 9 months ago by aicas.
    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    Thank you for your tests.

    This images:
    https://aicas.com/wp/wp-content/uploads/2020/12/shutterstock_1053687887-scaled.jpg

    Should redirect to this:
    https://aicas.com/wp/wp-content/uploads-webpc/uploads/2020/12/shutterstock_1053687887-scaled.jpg.webp

    And this does not happen. Tell me please, do you still have the code I entered in the .htaccess file?

    Can you clear the code from the .htaccess file in the main WP installation directory? Does it change anything?

    Thread Starter aicas

    (@aicas)

    Yes, the .htaccess in uploads is still using your temporary solution code with the paths instead of Document Root variable.

    I did remove the .htaccess in the main wordpress folder for a couple of minutes and tested redirection. Still not working.

    Really appreciate your help and would totally understand, if you don’t have time for this.

    Plugin Author Mateusz Gbiorczyk

    (@mateuszgbiorczyk)

    What is happening on your site is very strange.

    I would like to help you. Do you have the option to give me FTP access to your website? Then I can test different solutions and maybe I will succeed. If so, please contact me by email. You can find it on my website. I don’t want to give it here.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Plugin does not update .htaccess’ is closed to new replies.