Not working correctly on multisite network
-
Hi @sparkis70,
Thank you for your message.
The reports we receive very often do not concern a problem with the plugin operation, but problems with understanding how the plugin works. Below I have attached the tutorial describing how to test the plugin:
https://mattplugins.com/docs/how-to-test-converter-for-media-pluginTo be able to look at your website, I need its URL.
Best,
MateuszI can concur that when you network-enable the plugin on a WP multisite, it finds and converts the images on every single blog, but it doesn’t set the htaccess rules. I note in the Expert Settings section there are
- htaccess_rewrite_root
- htaccess_rewrite_path
- htaccess_rewrite_parent
- htaccess_rewrite_output
- htaccess_rewrite_flag_redirect
but couldn’t find any explanation on how to use them. Maybe there’s a link somewhere, but I must have missed it.
So I came up with these htaccess rules for multisite:RewriteEngine On
# ————————————————————
# 1. UPLOADS directory (any subdirectory under wp-content/uploads/)
# ————————————————————
# AVIF redirect
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/(.+).(jpe?g|png)$ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/%1.%2.avif -f
RewriteRule .* /wp-content/uploads-webpc/uploads/%1.%2.avif [R=302,NC,L]
# WebP redirect (if AVIF missing)
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/(.+).(jpe?g|png)$ [NC]
RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/uploads/%1.%2.webp -f
RewriteRule .* /wp-content/uploads-webpc/uploads/%1.%2.webp [R=302,NC,L]
# If neither AVIF nor WebP exists, serve the original file directly
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/(.+).(jpe?g|png)$ [NC]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI} -f
RewriteRule .* – [L]@thejasonator This is what the rules added to the .htaccess file in the /wp-content/ directory should look like:
# BEGIN Converter for Media # ! --- DO NOT EDIT PREVIOUS LINE --- ! <IfModule mod_rewrite.c> RewriteEngine On RewriteOptions Inherit RewriteCond %{QUERY_STRING} original$ RewriteCond %{REQUEST_FILENAME} -f RewriteRule . - [L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.avif -f RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.avif -f RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.avif -f RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/avif RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.webp.avif -f RewriteRule (.+)\.webp$ /wp-content/uploads-webpc/$1.webp.avif [NC,T=image/avif,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpg.webp -f RewriteRule (.+)\.jpg$ /wp-content/uploads-webpc/$1.jpg.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.jpeg.webp -f RewriteRule (.+)\.jpeg$ /wp-content/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{DOCUMENT_ROOT}/wp-content/uploads-webpc/$1.png.webp -f RewriteRule (.+)\.png$ /wp-content/uploads-webpc/$1.png.webp [NC,T=image/webp,L] </IfModule> <IfModule mod_headers.c> <FilesMatch "(?i)\.(jpg|png|webp|jpeg)(\.(webp|avif))?$"> Header always set Cache-Control "private" Header always set X-LiteSpeed-Cache-Control "no-cache" Header append Vary "Accept" </FilesMatch> </IfModule> # ! --- DO NOT EDIT NEXT LINE --- ! # END Converter for Media
You must be logged in to reply to this topic.

