Forum Moderators: phranque
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?THATPESKYDOMAIN\.com/ [NC,OR]
RewriteRule ^path/path/path/imagefilename\.jpg$ http://mydomain.com/?attachment_id=12345 [NC] RewriteCond %{HTTP_REFERER} THATPESKYDOMAIN\.com [NC] I can't get it to work.
I want those referred by that domain to be taken to a page uri instead of the full size image.
RewriteRule ^path/path/path/imagefilename\.jpg$ http://mydomain.com/?attachment_id=12345 [NC]
does the resource returned by the page uri match any of the acceptable content types specified in the Accept: header?
[NC,OR]
did you intend an internal rewrite here or a 302 status code?
does the resource returned by the page uri match any of the acceptable content types specified in the Accept: header?
there is reason the User Agent (browser) specifies the acceptable content type(s) in the Accept: header.
the browser is designed to render an image tag using an image-type resource.
Accept: image/gif, image/jpeg, image/*
This turned out not to be the case. Although the various image types are listed first in the "Accept:" header, there's always a */* fallback. (Weird corollary discovery: "image/gif" and "image/jpg" are standard; "image/png" is much less common. They don't seem to have anything to do with the actual extension of the requested file. I'm pretty sure I have way more pngs than gifs.) img src = "http://www.example.com/piwik/piwik.php?idsite=3&rec=1"
(I've never figured out what the "rec=1" part means, since the parameter is always present and never has any other value.) But requesting the file is one thing; acting on it is another. The browser will accept anything you send, but it will only display the file if it comes through in some kind of image format. The response can't override the whole containing page-- no competent browser would allow this-- so at most the hotlinking page might show the content of the new URL in a box the size of the image. Or some default size, if the hotlinker didn't say. (I have actually seen this, as noted elsewhere, but I do not know how it's done. Maybe it involves a command that can only be used in the config file.)