Tilted Forum Project Discussion Community

Tilted Forum Project Discussion Community (https://thetfp.com/tfp/)
-   Tilted Technology (https://thetfp.com/tfp/tilted-technology/)
-   -   [mod_rewrite] Defeating image hot-linking (https://thetfp.com/tfp/tilted-technology/59499-mod_rewrite-defeating-image-hot-linking.html)

seretogis 06-17-2004 09:46 AM

[mod_rewrite] Defeating image hot-linking
 
I've been looking around for the most efficient way to do this and I've learned how to deny access to linked files on my site, but replacing requests with a "denied" image is proving to be more of a pain in the ass.

Here's what I'm using:

Code:

Rewriteengine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://seretogis.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.seretogis.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://wrath.seretogis.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://word.seretogis.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://pwned.inf7.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.inf7.net/.*$ [NC]
RewriteRule .*\.(jpg|doc|txt|gif|bmp|jpeg|png)$ http://www.seretogis.org/files/linkables/dontlinkme.jpg [R,NC]

And here is a linked image so you can see what happens:
-http://www.seretogis.org/files/linkables/huggles.jpg-

Any ideas what may be the problem?

cthulu23 06-17-2004 02:59 PM

You've set up an infinite loop as the redirection url meets the redirection reqirements.

Edit: There is a built in safety check in Apache, but it is sensitive to slashes and other special characters. Maybe try giving the relative path to the jpg and don't start the path with a "/"...maybe something like "files/linkables/dontlinkme.jpg"

2nd edit: You also might need to use ReWriteBase in this case.

Halx 06-17-2004 05:50 PM

I just visit http://www.htmlbasix.com for their code generator

seretogis 06-17-2004 09:32 PM

Quote:

Originally posted by cthulu23
You've set up an infinite loop as the redirection url meets the redirection reqirements.
Yes, this was the problem! I simply renamed the dontlinkme.jpg file to dontlinkme.jpe and changed it appropriately in the .htaccess and it works like a charm. Many thanks!


All times are GMT -8. The time now is 08:13 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54