No webp files for only a few images
schmoe-github opened this issue · comments
Hi,
we have a website with hundreds of images. And for the most images, webp works. But there are a few images, which browser to tries to fetch the webp file which don't exist. And this turns out to a missing image error on the webpage.
We have no errors in the log file, the Apache Config is right after RewriteEngine On. We are using webp 4.12 on TYPO3 10.4.x
So far I understand the Apache Config, it should only take the webp file, if it exists on the filesystem. But in our case it takes it regardless if there is a .webp file or not.
Any ideas?
Kind regards
Hm, no ideas without your concrete configuration (rewrite rules).
These are our RewriteRules
<IfModule mod_rewrite.c>
# Enable URL rewriting
RewriteEngine On
############ webp
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} (.*)\.(png|gif|jpe?g)$
RewriteCond %{REQUEST_FILENAME}\.webp -f
RewriteRule ^ %{REQUEST_FILENAME}\.webp [L,T=image/webp]
<IfModule mod_headers.c>
<FilesMatch "\.(png|gif|jpe?g)$">
Header append Vary Accept
</FilesMatch>
</IfModule>
############ CAE - Weiterleitungen
RewriteRule ^shm$ https://www.woelfel.de/branchen/windenergie/cms-shm/shmtower.html [NC,L,R=301]
RewriteRule ^shm-tower$ https://www.woelfel.de/branchen/windenergie/cms-shm/shmtower.html [NC,L,R=301]
# http auf https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# Store the current location in an environment variable CWD to use
# mod_rewrite in .htaccess files without knowing the RewriteBase
RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
RewriteRule ^.*$ - [E=CWD:%2]
# Rule for versioned static files, configured through:
# - $GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename']
# - $GLOBALS['TYPO3_CONF_VARS']['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ %{ENV:CWD}$1.$3 [L]
# Access block for folders
RewriteRule _(?:recycler|temp)_/ - [F]
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [F]
RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ - [F]
# Block access to all hidden files and directories with the exception of
# the visible content from within the `/.well-known/` hidden directory (RFC 5785).
RewriteCond %{REQUEST_URI} "!(^|/)\.well-known/([^./]+./?)+$" [NC]
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule (?:^|/)\. - [F]
# Stop rewrite processing, if we are in the typo3/ directory or any other known directory
# NOTE: Add your additional local storages here
RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/) - [L]
# If the file/symlink/directory does not exist => Redirect to index.php.
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.*$ %{ENV:CWD}index.php [QSA,L]
</IfModule>
Hi,
got similar problem with creating webp-Images. The issue is reproducible for me, when trying to create a webP with the same with like it´s source-IMage (e.g. 2560px). In this case I get a file reference to the source-file (e.g. fileadmin/gfx/.../Image.jpg.webp instead of fileadmin/processed/.../.../csm....jpg.webp). After changing the source-format (e.g. 2540px) the needed file with higher width will be created.
Regards
Yes, that's correct, as stated in the README in the first paragraphs:
Adds an automagically created WebP copy for every processed jpg/jpeg/png/gif image in the format
So, images, that are returned without any changes (as is) are not processed (neither by TYPO3 core nor by this extension).
There must be something wrong with your rewrite rules (that should check if the .wep file actually exists).