Problem to get the right path
-
Hello,
1. I have a wp-multisite.
2. my images are at /public/pict_test/uploads and not at public/wp-content/uploads.So I use and change this code:
add_filter( 'webpc_site_root', function( $path ) { return ABSPATH; } ); add_filter( 'webpc_dir_name', function( $path, $directory ) { if ( $directory !== 'uploads' ) { return $path; } return 'pict_test/uploads'; }, 10, 2 ); add_filter( 'webpc_dir_name', function( $path, $directory ) { if ( $directory !== 'webp' ) { return $path; } return 'pict_test/uploads-webpc'; }, 10, 2 ); add_filter( 'webpc_htaccess_rewrite_path', function( $prefix ) { return '/'; } );The code adds this .htaccess to public/pict_test:
# BEGIN WebP Converter # ! --- DO NOT EDIT PREVIOUS LINE --- ! <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{DOCUMENT_ROOT}/pict_test/uploads-webpc/$1.jpg.webp -f RewriteRule (.+)\.jpg$ /pict_test/uploads-webpc/$1.jpg.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{DOCUMENT_ROOT}/pict_test/uploads-webpc/$1.jpeg.webp -f RewriteRule (.+)\.jpeg$ /pict_test/uploads-webpc/$1.jpeg.webp [NC,T=image/webp,L] RewriteCond %{HTTP_ACCEPT} image/webp RewriteCond %{DOCUMENT_ROOT}/pict_test/uploads-webpc/$1.png.webp -f RewriteRule (.+)\.png$ /pict_test/uploads-webpc/$1.png.webp [NC,T=image/webp,L] </IfModule> <IfModule mod_headers.c> <FilesMatch "(?i)\.(jpg|jpeg|png)(\.(webp|avif))?$"> Header always set Cache-Control "private" Header append Vary "Accept" </FilesMatch> </IfModule> # ! --- DO NOT EDIT NEXT LINE --- ! # END WebP ConverterThe code adds the folder public/pict_test/uploads-webpc
with this .htaccess:# 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 ConverterThe problem is, the converted images are in this folder now:
/public/pict_test/uploads/wp-content/uploads-webpc/.../users/.../apps/.../public/pict_test/uploads/sites/23/2022/04so,
1. with the full path and
2. not at public/pict_test/uploads-webpc, what I think is the right folder, or?What did I do wrong?
Thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Problem to get the right path’ is closed to new replies.