I've tried searching around for an answer but can't find any tutorials or docs I can make sense of so I'm not even sure if it's possible, but;
I would like to redirect/rewrite a URL if the last modified date or etag is in the request header. Something like:
RewriteEngine On
RewriteBase /
RewriteCond # Only if the request uri is 'images/1px.gif'
RewriteCond # And if an etag or last modified date is in the req. header
RewriteRule ^(.*)$ /304-this.php [L]
Note even sure if this is possible, if it's not what would you suggest be a better option.
Just to be clear, I also only want this redirect to fire if the request is for images/1px.gif
and there is an etag or a last modified date.
My theory is if the image is already in the browsers cache it will be sent with a etag or last modified date and in which case, I want PHP to handle the 304 response.
Thanks all!
You can use %{HTTP:...}
in a RewriteCond
for testing any header
RewriteCond %{HTTP:etag} . [OR]
RewriteCond %{HTTP:last-modified} .
RewriteRule images/1px.gif$ /304-this.php [L]