Author Topic: prevent hotlinking  (Read 41483 times)

0 Members and 1 Guest are viewing this topic.

Xepher

  • Techsmith
  • Administrator
  • *****
  • Posts: 4,328
  • Illegitimis non carborundum!
    • View Profile
    • Xepher.net
prevent hotlinking
« Reply #15 on: April 28, 2007, 07:02:21 am »
Code: [Select]
RewriteEngine On
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(www.)?chanpuru.org/ [NC]
RewriteCond %{HTTP_REFERER} !^http://griever.xepher.net/ [NC]
RewriteRule .(jpg|gif|png)$ http://griever.xepher.net/images/no_hotlink.gif [R,L]
Same as you had above, minus the "!no_hotlink..." line. Since you're just protecting the screencaps directory, put the .htaccess file IN the screencaps folder, then no need for exceptions for the no_hotlink image, since it's in another folder. If you put the one you had directly in public_html, it would, in fact, break your whole site, as it only allows images to work if they're referenced by a page in "screencaps" so all OTHER images on your site would break. I also shortened the two conditions, so you can link screencaps from ANY part of your site(s) rather than just from pages that are also inside screencaps.

The second problem, is that you wrote the file in Macintosh text format, which doesn't get read as a proper config file, since macs put weird characters at the end of each line. You can either get a text editor that can save stuff in dos or unix/linux format, OR you can run the command "mac2unix" on the file to convert it after it's uploaded. That is... "mac2unix /home/griever/public_html/images/screencaps/.htaccess" (or whatever file you're converting.)

Anyway, I've already done all that for this go round, and your screencaps directory should be protected.

griever

  • Sr. Member
  • ****
  • Posts: 457
    • View Profile
prevent hotlinking
« Reply #16 on: April 28, 2007, 08:14:36 am »
Quote from: Xepher
The second problem, is that you wrote the file in Macintosh text format, which doesn't get read as a proper config file, since macs put weird characters at the end of each line. You can either get a text editor that can save stuff in dos or unix/linux format, OR you can run the command "mac2unix" on the file to convert it after it's uploaded. That is... "mac2unix /home/griever/public_html/images/screencaps/.htaccess" (or whatever file you're converting.)
Thanks so much, Xepher!  And this is really good to know.  I had no idea before...the whole mess about trying to make clean links before?  I think I did all that in the Mac text editor.  That might explain why the end result was always a 500 error....
"You can get all A's and still flunk life." (Walker Percy)

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
prevent hotlinking
« Reply #17 on: April 29, 2007, 03:47:37 pm »
The funny thing is, technically though be it that they don't get the image, they still get an image which still steals at least some bandwidth. It just makes them look more like a thief. :P
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

griever

  • Sr. Member
  • ****
  • Posts: 457
    • View Profile
prevent hotlinking
« Reply #18 on: April 29, 2007, 11:19:50 pm »
Hmm...is there a better way to do it then?  I had kind of assumed that a "no hotlinking" image was the default way to deal with it.
"You can get all A's and still flunk life." (Walker Percy)

Xepher

  • Techsmith
  • Administrator
  • *****
  • Posts: 4,328
  • Illegitimis non carborundum!
    • View Profile
    • Xepher.net
prevent hotlinking
« Reply #19 on: April 29, 2007, 11:44:26 pm »
No, it's fine. That image is small enough to not really be a problem. It's more about the principal of the thing. Though, if you really want to bother people, go out and find some really bad image on some other site, and have it redirect to that one. Pro Nazi/Hitler images are nifty, as they get people banned from whatever forum they were trying to post on when they hotlinked. Not that you should... but it's funny. :-)

griever

  • Sr. Member
  • ****
  • Posts: 457
    • View Profile
prevent hotlinking
« Reply #20 on: April 30, 2007, 12:49:21 am »
Haha, yeah, or something gross, like tubgirl.  Or the man-Faye cosplayer.  I thought about doing something like that, but I didn't want to be rude about it.  I know they're being rude and all, but two wrongs....  Maybe I'll write a shaming message or something. :(
"You can get all A's and still flunk life." (Walker Percy)

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
prevent hotlinking
« Reply #21 on: May 01, 2007, 05:47:52 am »
Get a pic from somethingaweful.com... that's enough to just make people gouge their eyes out, the person would be ridiculed and probably banned.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

fesworks

  • Administrator
  • *****
  • Posts: 923
    • View Profile
    • http://www.fesworks.com
Re: prevent hotlinking
« Reply #22 on: May 17, 2007, 10:00:28 pm »
I'm going to attempt this, once I get a free moment, for my webcomic reviews... that is, if it works the same for MP3 files?

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: prevent hotlinking
« Reply #23 on: May 17, 2007, 10:32:02 pm »
I see no reason why not.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

Xepher

  • Techsmith
  • Administrator
  • *****
  • Posts: 4,328
  • Illegitimis non carborundum!
    • View Profile
    • Xepher.net
Re: prevent hotlinking
« Reply #24 on: May 18, 2007, 04:30:11 am »
Since mp3 files don't really load inline like images do (at least, not usually) you might want to redirect mp3 hotlinks to the main page for your radio program, where people can see that it's actually your stuff, then have the option to download/listen from there.

fesworks

  • Administrator
  • *****
  • Posts: 923
    • View Profile
    • http://www.fesworks.com
Re: prevent hotlinking
« Reply #25 on: May 18, 2007, 07:45:59 am »
Since mp3 files don't really load inline like images do (at least, not usually) you might want to redirect mp3 hotlinks to the main page for your radio program, where people can see that it's actually your stuff, then have the option to download/listen from there.


they were on the main page until I decided that the main page would take too long to load eventually... so I only have the main page hold a few. I have an Archive page for all of them too.

Basically, everytime I make an entry, I always make a bookmark link for it,(which can be found here: http://fesworks.xepher.net/TCSS/TCSS.htm ) and get a link like this: http://fesandernst.com/TCSS.htm#Voids

and go to the line in which  holds the link for that MP3.



I suppose it would be cool if it could be played like in a player on the site itself... I have not tried to do something like that before... but I would like for people to be able to download them as well...

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: prevent hotlinking
« Reply #26 on: May 18, 2007, 06:24:29 pm »
listing out the mp3's links wouldn't slow down your page's load times  :P
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

fesworks

  • Administrator
  • *****
  • Posts: 923
    • View Profile
    • http://www.fesworks.com
Re: prevent hotlinking
« Reply #27 on: May 18, 2007, 08:52:16 pm »
listing out the mp3's links wouldn't slow down your page's load times  :P

No I just didn't want people to link directly to the MP3 file itself.. I want them to visit the site to see the side ad and the other reviews.

Databits

  • Global Moderator
  • *****
  • Posts: 1,607
  • Programming's not just a science, it's an art.
    • View Profile
Re: prevent hotlinking
« Reply #28 on: May 19, 2007, 12:48:08 am »
But on the same note, if the content is difficult to find people lose interest in it. It's a double edged sword man.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

fesworks

  • Administrator
  • *****
  • Posts: 923
    • View Profile
    • http://www.fesworks.com
Re: prevent hotlinking
« Reply #29 on: May 19, 2007, 02:46:39 am »
But on the same note, if the content is difficult to find people lose interest in it. It's a double edged sword man.

It's not difficult! I provide a bookmark link for every single review and e-mail said link to each author.


hmmm.. I supposed I could put a "perma link" next to each one of them that IS the bookmark link....