Reputation: 1201
I am trying to incorporate Adaptive images - http://www.adaptive-images.com/ into my website.
Github account - https://github.com/MattWilcox/Adaptive-Images
Ideally the .htaccess should redirect all images to adaptive-images.php and the output should be resized images.
The images aren't loading. I checked the response headers and its returning text/html. It seems like the request is going to index.php file.
Below is the current .htaccess which i am using
<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>
The first part is where I'm trying to make it work
The second part works perfectly.
Upvotes: 2
Views: 1653
Reputation: 784888
You can change REQUEST_URI
with THE_REQUEST
that represents original Apache request and it doesn't change after application of other rules unlike 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>
Upvotes: 1