我正在使用此测试人员:http://htaccess.madewithlove.be/
我将从一开始就解释我的目标: 我有一台服务器。每次客户端要求服务器提供特定图像时,我希望服务器重定向到另一个图像(较新的图像)。
My full ISAPI htaccess:
===================
# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.60
RewriteEngine On
RewriteCompatibility2 On
RepeatLimit 32
RewriteBase
RewriteRule ^/Bing$ http://%{HTTP:Host} [NC,L,P]
RewriteRule ^/Zynga$ http://%{HTTP:Host} [NC,L,P]
RewriteRule ^/([0-9]+)$ http://%{HTTP:Host} [NC,L,P]
RewriteRule ^/CT([0-9]+)$ http://%{HTTP:Host} [NC,L,P]
RewriteRule ^images/infowindows/SPE_title.png$ http://%{HTTP_HOST}/images/infowindows/search.png [NC,L,R=301]
我在一些在线测试仪中尝试过,这似乎运行良好,如下所示: https://picasaweb.google.com/elad2109/ImageResourceRedirect?authkey=Gv1sRgCK6K3vegz4veDQ#5607413050992754706
然而,defato我看到旧图像被带到网站(客户端),并且也出现在Fiddler上 - 没有重定向(我不明白为什么!)
我在Fiddler看到了请求:
GET http://www108.MyHome.com/images/infowindows/SPE_ti... HTTP/1.1
Host: www108.conduitlive.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Referer: http://www108.MyHome.com/bing
Cookie: __utma=264109214.1078718614.1305536197.1305547582.1305556877.4; __utmc=264109214; __utmz=264109214.1305536197.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=69165847.1285126412.1305559921.1305559921.1305559921.1; __utmb=69165847.3.10.1305559921; __utmc=69165847; __utmz=69165847.1305559921.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
Pragma: no-cache
Cache-Control: no-cache
在这里可以看到一个sreenshot: https://picasaweb.google.com/elad2109/ImageResourceRedirect?authkey=Gv1sRgCK6K3vegz4veDQ#5607413044216373186
有没有人有任何想法,我做错了什么?
提前致谢
答案 0 :(得分:0)
你可以改变
RewriteRule ^images/infowindows/SPE_title.png$ http://%{HTTP_HOST}/images/infowindows/search.png [NC,L,R=301]
为:
RewriteRule ^/images/infowindows/SPE_title.png$ /images/infowindows/search.png [NC,L,R=301]
注意正则表达式开头的/
字符。这可能是问题的根源。