Thread revived, go to post #4. Hi guys, after following Smarter Image Hotlinking Prevention guide. I have the following in my 'hosted' directory /subdomain .htaccess file and would like to add a rule. Code: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} .*jpe?g$|.*gif$|.*png$ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !jazzle\.co\.uk [NC] RewriteCond %{HTTP_REFERER} !bit-tech\.net [NC] RewriteCond %{HTTP_REFERER} !google\. [NC] RewriteCond %{HTTP_REFERER} !search\?q=cache [NC] RewriteRule (.*) /hosted/_showpic.php?pic=$1 I'd like to use _showpic for all requests from the index, so thought I could use Code: RewriteCond %{HTTP_REFERER} hosted\.jazzle\.co\.uk [NC] but it doesn't seem to work. Can anyone tell me what I should do?
So are you trying to say that you want all images linked to/displayed on hosted.jazzle.co.uk to pass through the _showpic.php script? I think that the problem there would be that the line: Code: RewriteCond %{HTTP_REFERER} !jazzle\.co\.uk [NC] Would say anything from whatever.jazzle.co.uk will not go through the script. You may have to add some other crazy regular expression stuff in the same line, but I'm not sure, since I'm not too comfortable with regular expressions myself. (I'm just throwing out what little I do know, hopefully someone will come correct me and solve your problem!) So, when do you want this script to show up? When it comes from hosted.jazzle.co.uk, but not when it comes from jazzle.co.uk? Also, just a small test/sample: Instead of linking to a text document, I just add an annoying bar in the middle of the image with server info. Then, if you are on my site, http://bit-tech.woventhorns.com then manually type in ubuntu.png, it should look normal.
yeah, it will be todo with that line - didn't really occur to me, so it might just be a bit of regex malarkey. how do you do your 'annoying bar'? what is the mime type of the returned object?
EDIT: Solved. I want to allow hotlinking from my own site (and a few select others, like bit-tech). I don't want anyone else to hotlink. I'd like some referers (sic) to get sent to my _showpic.php script. Solved: Code: ...<snip>... RewriteEngine On RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(.+\.)?jazzle\.co.\uk [NC] RewriteCond %{HTTP_REFERER} !^http://(.+\.)?bit-tech\.net [NC] RewriteCond %{HTTP_REFERER} !^http://(.+\.)?google\. [NC] RewriteCond %{HTTP_REFERER} !^http://(.+\.)?search\?q=cache [NC] RewriteRule .*\.(jpe?g|gif|bmp|png)$ red-x.gif [NC,L] RewriteCond %{HTTP_REFERER} ^$ RewriteCond %{HTTP_REFERER} ^http://(.+\.)?jazzle\.co.\uk [NC] RewriteRule (.*\.(jpe?g|gif|bmp|png))$ http://hosted.jazzle.co.uk/_showpic.php?pic=$1 [NC,L]