|
#85349
07/29/2002 5:16 PM
|
Joined: Nov 2000
Posts: 915
Developer
|
Developer
Joined: Nov 2000
Posts: 915 |
I remember seeing this a while ago here in the admin forum, but since I can't view that now, thought I'd ask. I know some people who have sites on our site network and people are linking to their images (car blueprints) and stealing bandwidth. I know it involves the rewrite engine. I'd like to possible block all .gif and .jpg files from being linked and then replacing the images with a 'You are linking to a file on our servers and stealing our bandwidth. Please cease and desist." image.
Cheers, Dan
|
|
|
#85350
07/29/2002 5:52 PM
|
Joined: Nov 2000
Posts: 915
Developer
|
Developer
Joined: Nov 2000
Posts: 915 |
Nevermind, did some searches on google and put this together and it works fairly well: RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://www.my-site.com/.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://my-site.com/.*$ [NC] RewriteRule .*.(jpg|gif)$ illegaly-linked-image [L]
|
|
|
#85351
07/30/2002 11:01 PM
|
Joined: Jun 2001
Posts: 2,849
Spotlight Winner
|
Spotlight Winner
Joined: Jun 2001
Posts: 2,849 |
What is the actual syntax for the link to the image in this line? code:
RewriteRule .*.(jpg|gif)$ illegaly-linked-image [L]
In other words, do I need to use this. code: [qb] RewriteRule .*.(jpg|gif)$ !^http://www.netwerkin.com/images/dont_steal.jpg$ [L] [/qb] Or without the tags around the URL like this?
|
|
|
#85352
07/31/2002 12:39 AM
|
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
|
Admin Emeritus
Joined: Jan 2000
Posts: 5,073 |
As an example, here's the one I use: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?solareclipse.net/ [NC] RewriteRule .(gif|jpg)$ http://solareclipse.net/stolen.gif [R,L] Yes, this does work - the .htaccess is in a subdirectory, so stolen.gif itself isn't filtered. If you want to protect your entire site, you should be able to get away with creating a subdirectory, then .htaccessing it with RewriteEngine off.
UBB.classic: Love it or hate it, it was mine.
|
|
|
#85353
07/31/2002 8:59 AM
|
Joined: Feb 2001
Posts: 817
Moderator / Kingpin
|
Moderator / Kingpin
Joined: Feb 2001
Posts: 817 |
Is there a way to use this but exempt some specific files located in the directory your protecting and also allow some specific websites?
|
|
|
#85354
07/31/2002 9:07 AM
|
Joined: Nov 2000
Posts: 915
Developer
|
Developer
Joined: Nov 2000
Posts: 915 |
quote:
Originally posted by usr bin geek: Is there a way to use this but exempt some specific files located in the directory your protecting and also allow some specific websites?
I'm not sure about exempting some files, but if you want to allow certain specific other sites, just add some more conditions: code: [qb]RewriteCond %{HTTP_REFERER} !^http://(www.)?site1.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://(www.)?site2.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://(www.)?site3.com/ [NC] RewriteCond %{HTTP_REFERER} !^http://(www.)?site4.com/ [NC] [/qb] etc... 
|
|
|
#85355
07/31/2002 10:23 AM
|
Joined: Jan 2000
Posts: 5,073
Admin Emeritus
|
Admin Emeritus
Joined: Jan 2000
Posts: 5,073 |
I *THINK* that you can do this, but I'm not sure:
RewriteEngine off
UBB.classic: Love it or hate it, it was mine.
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 69
Joined: January 2001
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|
|