posted
(I figured revisiting this topic was better than starting a new one...)
Okay, after finding some interesting articles on the subject of mod_rewrite and discovering that my host does indeed provide the mod_rewrite module (in addition to the "Hotlink Protector" feature, for some silly reason), I'm going to give this another try.
Charles, would you be kind enough to show me those scripts you mentioned earlier? I've found info on the basics, but there are a few things I'm not clear about...
For instance, I want to allow hotlinking to my website's banner, which is advertisement and thus would be bad if it's blocked. So basically, I want to leave that one image completely open, and restrict all other pics to a few select URLs.
Thanks!
Oh, and I did get around to fixing that rather garish flashing image, as well as shrinking it. Basically, I made it into a softer color transition instead of a straight back-and-forth flash.
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
posted
Apache RewriteCond works wonders lowering the bandwidth usage on my domains from dumbasses who link to my files.
-------------------- Picard: Mr. Crusher, what's our maximum speed this week? Wesley: [checking manual] Uh, 9.4, sir. Picard: Very good. Take us to Warp 9.8 then. Wesley: Aye, sir. Warp 9.2 it is.
Registered: Mar 1999
| IP: Logged
quote:For instance, I want to allow hotlinking to my website's banner, which is advertisement and thus would be bad if it's blocked.
You use .htaccess, right? Then put all your images in one folder and protect it with .htaccess. Leave your banner in a non-protected folder. Done.
Or you could replace your Red Alert picture with the banner. So, everyone who hotlinks to your banner gets the banner, and people who hotlink to other pictures get the banner as well.
-------------------- "Never give up. And never, under any circumstances, no matter what - never face the facts." - Ruth Gordon
Registered: Mar 2000
| IP: Logged
posted
The problem with that is that I already keep all of my site-wide images in one place. And I can't really move my single banner graphic, because that's the one that is linked externally -- moving that would invalidate the link and make the banner useless.
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
I believe things should be working... three different images should show up, because Flare is one of the places where I've permitted hotlinks to my site.
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
EDIT: Erm, you do realize that your first banner has REFERENCE misspelled, right?
-------------------- "Lotta people go through life doing things badly. Racing's important to men who do it well. When you're racing, it's life. Anything that happens before or after is just waiting."
-Steve McQueen as Michael Delaney, LeMans
Registered: Mar 1999
| IP: Logged
A typo that's been in a file I haven't edited in a whole year!!! Ouch, how embarrassing... Thanks for the tip!
Also, I've been making some changes to the .htaccess file, so the images may disappear -- they shouldn't, though, so if they're gone it means I've screwed something up.
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
posted
Okay, it seems as if I'm missing something here... would someone more familiar with the mod_rewrite commands give this a quick look?
I've used the instructions provided on this page, along with the basic example shown here. However, after thoroughly reading the Apache page instructions, I thought I was smart enough to put some other pieces together and allow access to specific files as I indicated earlier.
However, there are two problems: (1) My server is denying access to hotlinked images where it's supposed to (I've checked a few pages that I know have stole images), but it's not replacing those images with the specified "Access Denied" file. (2) The server is not allowing access to the specific files (specifically, my banner) as I thought I'd told it to.
The script IS working, though, by allowing the allowed domains to have access (like Flare). So that's good news, at least.
As you can see, I tossed in the %{REQUEST_URI} variable which was described in the Apache documentation -- I *thought* it would do what I was asking it to, but it's apparently not.
Any suggestions, please?
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
posted
It's case-sensitive, so you could always use an uppercase extension on your access_denied.gif file and it wouldn't be included in the RewriteRule.
-------------------- Picard: Mr. Crusher, what's our maximum speed this week? Wesley: [checking manual] Uh, 9.4, sir. Picard: Very good. Take us to Warp 9.8 then. Wesley: Aye, sir. Warp 9.2 it is.
Registered: Mar 1999
| IP: Logged
posted
The problem with that is that I can't change any of the URL's I'm working with -- at least, not the URL of the image banner. That's the one that's used by other sites, and would end up ruining the links of all those not-so-attentive webmasters out there who advertise my site. And working the other way around (changing all the other graphics) would be way too time-consuming to be practical.
I'm pretty sure that what I've got here is correct for the most part -- there's probably just something I'm not doing right, like a typo somewhere. *sigh*
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
Okay, after careful reading, I figured out what was wrong -- and just as I expected, the mistake was a stupid one. The only thing I was doing wrong, was that I had entered the full "http://[domain name]" in the %{REQUEST_URI} variable, when all they wanted was everything *after* the .com...
And to show the results, I give you a link one website which blatantly stole not only my images, but even my HTML code. (If you look at the source code for the linked page, you'll notice some weird "X-CLARIS" labels inside the <img> tags that were placed there by the website creation program that I used up to about a year ago. I would have complained to the webmaster a while ago, but this charming individual has no e-mail links on any of his pages.
I provide below my final code. I hope someone else can make use of it!
code:
RewriteEngine on # The following lones will allow specific websites to pass # through -- especially your own. Be sure to differentiate if # you've got a non-WWW access. Also, the [NC] tag is # essential to make it a "no case" -- that is, a case to be ignored. RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://st-minutiae.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.st-minutiae.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://startrekrenaissance.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.startrekrenaissance.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://scn.infopop.net/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://flare.solareclipse.net/.*$ [NC] # The next lines allow you to exempt specific URI's that you # WANT to share with others -- for example, a banner graphic. RewriteCond %{REQUEST_URI} !^/graphics/access_denied.gif$ [NC] RewriteCond %{REQUEST_URI} !^/graphics/banner2.gif$ [NC] RewriteCond %{REQUEST_URI} !^/temp/.*$ [NC] # And finally, the actual rule to apply when the above # conditions are *not* met. Specifically, substitute the image # with one complaining about stolen bandwidth. RewriteRule .*\.(gif|jpg)$ http://www.st-minutiae.com/graphics/access_denied.gif [R,L]
This whole thing (with the appropriate modifications for your own site) should be pasted into a text file that you name ".htaccess" with the leading period.
I'm hardly an expert at this yet, but if anyone's got questions about this, I think I can provide enough guidance for the basic Trek website...
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged
posted
Augh! I went to MM's site out of curiosity to confirm Topher's claim, and I just wasted probably an hour or so of combinatorics study time reading those "You're the Admiral" sample answers. Damn you people for creating amusing reading!
Registered: Mar 1999
| IP: Logged
posted
On a somewhat related note, there's an interesting article in someone's weblog entitled Hot to Block Spambots, Ban Spybots, and Tell Unwanted Robots to Go to Hell. The title is actually more interesting than the actual article, unless you're a webmaster of a really popular website. (I checked my referrer logs for some of the most prominent spambots listed, and I didn't find any of them.)
-------------------- “Those people who think they know everything are a great annoyance to those of us who do.” — Isaac Asimov Star Trek Minutiae | Memory Alpha
Registered: Nov 2000
| IP: Logged