Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Rewrite image for specific referrer


batface - 4:54 pm on Nov 9, 2012 (gmt 0)


Whenever you say . quoting your htaccess you really mean \.
Whenever you say ^1.1.1.1 you really mean your own IP


That is the IP of the website with the link to the URL I want to use the alternative image, not my own IP address.

Any difference if you also give a $ closing tag for the IP?

No

What do your logs say?


One example is:
86.159.xxx.xxx - - [08/Nov/2012:04:43:06 +0100] "GET /Landingpage/index.html HTTP/1.1" 200 630 "http://www.example.com/test.html" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4"

So I see the initial IP address is mine - BT Internet, then the referrer is http://www.example.com/test.html. It was originally making sense to me to use:
RewriteCond %{REMOTE_REFERER} ^http://www\.example\.com.*$ [NC]

but as with either REMOTE_HOST or REMOTE_ADDR using the IP for example.com the alternative image is not displayed.

Ironically and annoyingly setting to 'not' ! always gives me the alternative image. I'm left thinking this works but my condition is wrong. I've tried all these kind of alternatives (also with REMOTE_HOST and REMOTE_ADDR):
RewriteCond %{REMOTE_REFERER} !^http://www\.example\.com.*$ [NC]
#RewriteCond %{REMOTE_REFERER} ^http://1\.1\.1\.1$ [NC]
#RewriteCond %{REMOTE_REFERER} ^http://1\.1\.1\.1.*$ [NC]
#RewriteCond %{REMOTE_REFERER} ^http://1\.1\.1\.1:80.*$ [NC]

I want traffic from http://www.example.com/test.html to get the alternative image.


Thread source:: http://www.webmasterworld.com/apache/4515652.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com