我正在尝试将自适应图像- http://www.adaptive-images.com/整合到我的网站中。
Github帐户- https://github.com/MattWilcox/Adaptive-Images
理想情况下,.htaccess应该将所有图像重定向到AdaptiveImages.php,并调整输出图像的大小。
图像没有载入。我检查了响应头及其返回的文本/html。似乎请求将转到index.php文件。
下面是我正在使用的当前.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
# Send any GIF, JPG, or PNG request that IS NOT stored inside ai-cache
# to adaptive-images.php
RewriteCond %{REQUEST_URI} !/ai-cache
RewriteRule \.(jpe?g|gif|png)$ adaptive-images.php
# Send all files except css, js or image files to index.php
RewriteBase /
RewriteCond %{REQUEST_URI} !(\.css|\.js|\.png|\.jpg|\.gif|robots\.txt)$ [NC]
RewriteRule ^.*$ index.php
</IfModule>
第一部分是我试图让它发挥作用的地方
第二部分工作得很好。
发布于 2017-12-06 09:20:12
您可以使用表示原始REQUEST_URI
请求的THE_REQUEST
来更改REQUEST_URI
,并且在应用其他规则之后不会改变,这与REQUEST_URI
不同。
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Send any GIF, JPG, or PNG request that IS NOT stored inside ai-cache
# to adaptive-images.php
RewriteCond %{REQUEST_URI} !/ai-cache [NC]
RewriteRule \.(jpe?g|gif|png)$ adaptive-images.php [L]
# Send all files except css, js or image files to index.php
RewriteCond %{THE_REQUEST} !(robots\.txt|\.(css|js|png|jpe?g|gif)) [NC]
RewriteRule . index.php [L]
</IfModule>
https://stackoverflow.com/questions/47670596
复制相似问题