The .htaccess file works, but loading a .jpg, .png and .gif
file loads it directly from the disk, bypassing Apache and executing the rules from the .htaccess file.
This problem depends on the file extension (for .png format it doesn’t work, for example for .png2 format it works). The plugin shows a message because it has detected a configuration problem.
For testing, it uses the following rules:
# BEGIN WebP Converter
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule icon-before\.(.+)$ ./icon-after.$1 [NC,E=cache-control:private,L]
</IfModule>
# END WebP Converter
Rules rules are found in file:
/wp-content/plugins/webp-converter-for-media/public/img/.htaccess
These rules are redirected from icon-before.*
(small, contains red text) to icon-after.*
(large, contains green string). This means that the extension does not matter for redirection.
Redirection does not work for the .png
file:
https://daneloo.com/wp-content/plugins/webp-converter-for-media/public/img/icon-before.png
And for the .png2
file, the redirection works:
https://daneloo.com/wp-content/plugins/webp-converter-for-media/public/img/icon-before.png2
This is the test result:
https://gbiorczyk.pl/plugins/webp-conveter-for-media/apache_bypassing.png
As you can see, the redirections for both files are the same, so why for .png2
does the redirection work and not .png
not? The file extension does not matter, because any string ((.+)
) is allowed there.
Remember that server administrators are not always helpful. It is faster and more convenient to say that this is a problem on the redirection side than on the configuration. The problem is rare, but there are several threads in the forum of people who had this type of problem and after changing the server configuration everything started to work.
Operation of this plugin is based on redirections from the .htaccess file, and if the server ignores them, I can not do anything.