我试着到处寻找答案,但找不到任何我能理解的教程或文档,所以我甚至不确定这是否可能,但是;
如果最后修改日期或etag在请求标头中,我希望重定向/重写URL。类似于:
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]注意,即使确定这是否可能,如果不是,你会建议什么是更好的选择。
为了清楚起见,我也只希望在请求为images/1px.gif并且有etag或上次修改日期的情况下触发此重定向。
我的理论是,如果图像已经在浏览器缓存中,它将与etag或上次修改日期一起发送,在这种情况下,我希望PHP处理304响应。
谢谢大家!
发布于 2013-02-23 01:18:15
您可以在RewriteCond中使用%{HTTP:...}来测试任何标头
RewriteCond %{HTTP:etag} . [OR]
RewriteCond %{HTTP:last-modified} .
RewriteRule images/1px.gif$ /304-this.php [L]https://stackoverflow.com/questions/15029338
复制相似问题