问题描述
这是我的重写规则:
RewriteEngine On
RewriteBase /
# check if user supports webp
RewriteCond %{HTTP_ACCEPT} !image\/webp
# see if url has webp extension,and store the name and the extension with the case
## so if the user enters WEBp,webP,etc. I get the name exactly,so
## that I can see if a file with the exact name exists
RewriteCond %{REQUEST_URI} (.*)\.(webp)$ [NC]
# check if the webp file exists,# remember we use the extension with the case,like
# WebP,webP etc. as we are using linux
RewriteCond %{DOCUMENT_ROOT}%1\.%2 -f
# check if jpg,jpeg or png file exists
RewriteCond ${DOCUMENT_ROOT}%1\.(jpe?g|png) -f [NC]
# redirect user to jpe?g | png file with the case,# so,if a jpg file like example.JPeG exists,we want to redirect to JPeG,not jpeg
RewriteRule ^ %1.%3 [NC,R=301,L]
以上不行!如何使它重定向到存在的文件的区分大小写的名称: 所以,如果所有条件都满足,并且一个名为 (webp 文件名).jpEg 的文件存在,我们希望将它们重定向到 (webp 文件名).jpEg,而不是 (webp 文件名).jpeg
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)