How do I prevent hotlinking to my website?

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
My website is hosted at Gisol.com. I've tried a few .htaccess generators, such as something like this:
--------------------
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?jeff7.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://www.jeff7.com/~~~~~~hotlink.png [R,NC]

Options -Indexes
--------------------

Some problems then show up:
Hotlinked images here still work fine.
Hotlink htaccess tester - while the hotlinked images at the SHSPVR site work fine, this site will either show no image, or it will attempt to contact my server 10 or more times before giving up.

So it seems that this .htaccess is not quite doing the trick. Any ideas on what's going on?
My eventual goal: Prevent all hotlinking except to sites I specifically allow.
 

Malak

Lifer
Dec 4, 2004
14,696
2
0
Whoever runs pics.bbzzdd.com should be able to help ya, they have it setup like that.
 

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
Good point - though those folks seem to have something going that's a LOT more complex than I may need.
That, and when I go to their Sourceforge page, and click Download, it says "No File Packages Defined - This project has not yet created any file release packages."
 

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
Well I think I've nearly got it. My htaccess blocks hotlinks at sites like this blog, and a few others. One was hotlinking to a 152KB image for use as a background image. I replaced it with this. She got the idea.....not to hotlink to my server. Now she's hotlinking to a 450KB image on someone else's server. Her entire website is more than 600KB, including an auto-playing music file.:roll: M4D 733T HTM7 SK!77Z

Still having trouble getting it to work right from eBay though, such as from this past auction.
Neither of these lines has any effect:
RewriteCond %{HTTP_REFERER} !^http(s)?://<cgi\.)?ebay.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?ebay.com [NC]
 

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
Originally posted by: joedrake
Awww you shoulda put something innapropiate!

I know, but it was her first offense, and she obviously doesn't have even the slightest clue about what she's doing online. I probably should have included a definition of "hotlink" as her subsequent actions (simply hotlinking to another site) indicate that she is totally clueless.

And I think I got the eBay thing to work now - updated the .htaccess file in my auction folder. It's more of a patch though - I don't know why the main .htaccess file won't allow eBay's servers to access those images.
 

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
Interesting discovery:
Back to the top. My .htaccess seemed to do an ok job of preventing hotlinking, especially seeing how my hotlink.png file is my single most-requested file on my webserver. :Q
But one site I just found, Riff Raff Running, has hotlinked to an image on my site, and it loads fine for them. (The post is most of the way down on the page. Search the page for "I hope it doesn't" and you should find it quickly.
Instead of the popular "sunny day" picture there, it should show my hotlink.png file, but it doesn't.
Anyone here happen to know why that is?


Edit: This is what is supposed to happen when someone hotlinks.

Second edit: When I load the Riff Raff page in Firefox, the sunny day.jpg file loads. In IE, the hotlink.png file loads.:confused:
Another example - in Firefox, the image loads. In IE, the hotlink.png file loads like it's supposed to. Is Firefox behaving badly, or is Xanga.com?
 

Shuxclams

Diamond Member
Oct 10, 1999
9,286
15
81
For the sake of keeping the AT effect from using your jeff7.com.png why dont you change that part of the code... LoL

Very cool BTW....... I assume MOD_REWRITE is enabled.





SHUX
 

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
Originally posted by: Shuxclams
Very cool BTW....... I assume MOD_REWRITE is enabled.

Uh....sure! Why not?

?????

I assume it is enabled because it is referenced in the .htaccess, and hotlinkers are successfully diverted to the hotlink.png image most of the time. Other than that, I haven't got a clue about what exactly MOD-REWRITE is.

I researched this enough to get it to have some basic degree of functionality. I guess there is a lot more to it.
 

computeerrgghh

Golden Member
Apr 10, 2005
1,121
0
0
Originally posted by: Jeff7
Interesting discovery:
Back to the top. My .htaccess seemed to do an ok job of preventing hotlinking, especially seeing how my hotlink.png file is my single most-requested file on my webserver. :Q
But one site I just found, Riff Raff Running, has hotlinked to an image on my site, and it loads fine for them. (The post is most of the way down on the page. Search the page for "I hope it doesn't" and you should find it quickly.
Instead of the popular "sunny day" picture there, it should show my hotlink.png file, but it doesn't.
Anyone here happen to know why that is?


Edit: This is what is supposed to happen when someone hotlinks.

Second edit: When I load the Riff Raff page in Firefox, the sunny day.jpg file loads. In IE, the hotlink.png file loads.:confused:
Another example - in Firefox, the image loads. In IE, the hotlink.png file loads like it's supposed to. Is Firefox behaving badly, or is Xanga.com?


Are you sure its not your cache? On the Riff Raff page, I see the jeff7.png file come up
 

Jeff7

Lifer
Jan 4, 2001
41,596
20
81
Originally posted by: computeerrgghh
Originally posted by: Jeff7
Interesting discovery:
Back to the top. My .htaccess seemed to do an ok job of preventing hotlinking, especially seeing how my hotlink.png file is my single most-requested file on my webserver. :Q
But one site I just found, Riff Raff Running, has hotlinked to an image on my site, and it loads fine for them. (The post is most of the way down on the page. Search the page for "I hope it doesn't" and you should find it quickly.
Instead of the popular "sunny day" picture there, it should show my hotlink.png file, but it doesn't.
Anyone here happen to know why that is?


Edit: This is what is supposed to happen when someone hotlinks.

Second edit: When I load the Riff Raff page in Firefox, the sunny day.jpg file loads. In IE, the hotlink.png file loads.:confused:
Another example - in Firefox, the image loads. In IE, the hotlink.png file loads like it's supposed to. Is Firefox behaving badly, or is Xanga.com?


Are you sure its not your cache? On the Riff Raff page, I see the jeff7.png file come up

<Chief Wiggum>
Alright, I'm going to have to write you up for a Ten-niner-seven, making an officer look like an idiot.
</Wiggum>


Grrrr.....
Ok people, go back to your homes. Nothing to see here. :eek:

I get the "J00 suck 4t t3h !ntr4w3b" award for this week.
 

imported_BadKarma

Senior member
Dec 6, 2004
328
0
0
Originally posted by: Jeff7
Originally posted by: computeerrgghh
Originally posted by: Jeff7
Interesting discovery:
Back to the top. My .htaccess seemed to do an ok job of preventing hotlinking, especially seeing how my hotlink.png file is my single most-requested file on my webserver. :Q
But one site I just found, Riff Raff Running, has hotlinked to an image on my site, and it loads fine for them. (The post is most of the way down on the page. Search the page for "I hope it doesn't" and you should find it quickly.
Instead of the popular "sunny day" picture there, it should show my hotlink.png file, but it doesn't.
Anyone here happen to know why that is?


Edit: This is what is supposed to happen when someone hotlinks.

Second edit: When I load the Riff Raff page in Firefox, the sunny day.jpg file loads. In IE, the hotlink.png file loads.:confused:
Another example - in Firefox, the image loads. In IE, the hotlink.png file loads like it's supposed to. Is Firefox behaving badly, or is Xanga.com?


Are you sure its not your cache? On the Riff Raff page, I see the jeff7.png file come up

<Chief Wiggum>
Alright, I'm going to have to write you up for a Ten-niner-seven, making an officer look like an idiot.
</Wiggum>


Grrrr.....
Ok people, go back to your homes. Nothing to see here. :eek:

I get the "J00 suck 4t t3h !ntr4w3b" award for this week.


rofl

:cookie: