Forum Moderators: phranque
Is this synthax correct?
RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.239\.(3[2-9]¦[45][0-9]¦6[0-3])\..*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://64\.233\.167\.104.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://64\.233\.183\.104.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://66\.102\.9\.104.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.109\.117\.135.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.109\.124\.98.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.239\.37\.104.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://216\.239\.39\.104.*(www\.)?mydomain\.net/ [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?world\.altavista\.com.*(www\.)?mydomain\.net/ [NC]
RewriteRule .*\.(gif¦ico¦jpe?g¦bmp¦wmf¦mid¦rmi¦rm¦ram¦au¦wav¦art¦img)$ - [F,NC]
For the record, syntax like this:
RewriteRule .*\.(gif¦jpg)$ - [F,NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.net/.*$ [NC]
Could be written better as:
RewriteRule \.(gif¦jpg)$ - [F,NC,L]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?mydomain\.net/ [NC]
IOW, don't use '.*' when it's not needed. As to whether the config you posted will do what you want, we'd need to know what you're trying to accomplish and see the type of Referer: headers you're getting to be able to answer that question.
- I want to give permission to www.mydomaine.com to link its own images.
- I want to give permission to Yahoo, Google cache and search Images to make links on mydomain.com
- Same thing for world.altavista which traduce my pages in others language.
- I found 216\.239\.(3[2-9]¦[45][0-9]¦6[0-3]) on [webmasterworld.com...]
Unfortunatly, the link [webmasterworld.com...] given by jdMorgan is not valid
I found also in my logs:
[google.com...] and so on.........
[google.com...] and so on.........
[google.fr...] and so on.........
[66.102.9.104...] and so on.........// Google
[64.233.183.104...] and so on.........// Google
[216.109.124.98...] and so on.........
[216.239.59.104...] and so on.........// Google
[216.239.37.104...] and so on.........//
[cc.msnscache.com...] and so on.........//MSN
Is it possible to replace all this IP (Google, Yahoo) with:
RewriteCond %(HTTP_REFERER) "!\/custom\?hl="
RewriteCond %(HTTP_REFERER) "!\/custom\?cof="
RewriteCond %(HTTP_REFERER) "!\/search\?hl="
RewriteCond %(HTTP_REFERER) "!\/search\?q=cache"
RewriteCond %(HTTP_REFERER) "!\/search\/cache\?ei="
RewriteCond %(HTTP_REFERER) "!\/translate_c\?hl="
RewriteCond %(HTTP_REFERER) "!\/search\?q=cache"
RewriteCond %(HTTP_REFERER) "!\/cache.aspx\?q="
as seen in [webmasterworld.com...]
But, probably we should write (for example):
RewriteCond %(HTTP_REFERER) "!\/custom\?hl=".*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/custom\?hl=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/custom\?cof=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/search\?hl=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/search\?q=cache.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/search\/cache\?ei=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/search\/cache\?p=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/search\?sourceid=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/search\/images\?p=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/images\?q=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/imgres\?imgurl=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/translate_c\?hl=.*(www\.)?mydomain\.com/ [NC]
RewriteCond %(HTTP_REFERER)!\/cache\.aspx\?q=.*(www\.)?mydomain\.com/ [NC]
Is it correct, now?