开发者

RewriteCond %{HTTP_HOST} doesn't work

I'm using this tester: http://htaccess.madewithlove.be/

I'll explain my goal from the beginning: I have a server. Everytime the client asks the server for a specific image, I want the server to redirect to another image (a newer one).

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/inf开发者_StackOverflowowindows/SPE_title.png$ http://%{HTTP_HOST}/images/infowindows/search.png [NC,L,R=301]

Which I have tried in some online tester, and that seems to work well, as can be seen here: https://picasaweb.google.com/elad2109/ImageResourceRedirect?authkey=Gv1sRgCK6K3vegz4veDQ#5607413050992754706

However, defato I see the old image brought to the website (client) and that also appears via Fiddler - no redirection is done (and I don't understand why !)

i see the request in 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

A sreenshot can be seen here: https://picasaweb.google.com/elad2109/ImageResourceRedirect?authkey=Gv1sRgCK6K3vegz4veDQ#5607413044216373186

Does anyone have any Idea, what am I doing wrong?

Thanks in advance


You could change

RewriteRule ^images/infowindows/SPE_title.png$ http://%{HTTP_HOST}/images/infowindows/search.png [NC,L,R=301]

to:

RewriteRule ^/images/infowindows/SPE_title.png$ /images/infowindows/search.png [NC,L,R=301]

Notice the / character in the beginning of the regex. This could be the root of the problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜