Plugin does not update .htaccess
-
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
-
Hi @aicas,
Thank you for your message.
What .htaccess file is not updated? Please describe your case carefully.
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?
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.
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 ConverterThe 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.
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.
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?
– No2. URL of your website
– https://www.aicas.com3. 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.png4. Do you use CDN?
– No5. 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 Filewp-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.010. Used WordPress version?
– Version 5.4.211. 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 ResetWhen 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.
Thank you so much for all the information! Can you tell what the value of
$_SERVER['DOCUMENT_ROOT']
is on your server?Document Root is:
/kunden/homepages/17/d33475532/htdocsIt 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?
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.phpmod_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.pngAnother 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 pathhttps://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.
Thank you for your tests.
This images:
https://aicas.com/wp/wp-content/uploads/2020/12/shutterstock_1053687887-scaled.jpgShould redirect to this:
https://aicas.com/wp/wp-content/uploads-webpc/uploads/2020/12/shutterstock_1053687887-scaled.jpg.webpAnd 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?
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.
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.
-
This reply was modified 4 years, 9 months ago by
- The topic ‘Plugin does not update .htaccess’ is closed to new replies.