News:

The anti-spam plugins have stopped being effective. Registration is back to requiring approval. After registering, you must ALSO email me with your username, so that I can manually approve your account.

Main Menu

prevent hotlinking

Started by griever, February 17, 2007, 07:50:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Xepher

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

Quote from: XepherThe 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

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

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

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

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

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

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?

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com

Databits

I see no reason why not.
(\_/)    ~Relakuyae D'Selemae
(o.O)    
(")_(")  [Libre Office] [Chrome]

Xepher

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

Quote from: Xepher 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.


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...

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com

Databits

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

Quote from: Databits on May 18, 2007, 06:24:29 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.

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com

Databits

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

Quote from: Databits 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.

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....

www.PSIwebcomic.com
www.TheShifterArchive.com
www.ArdraComic.com
www.WebcomicBeacon.com