Helpful Information
 
 
Category: System Administration
.htaccess help

I'm trying to use the .htaccess file to protect the directory I use for all of my images on my site. It allows only sites that I specify within it to link off of graphics from my site. The code is as follows:

# Rewrite Rule for images
RewriteCond %{HTTP_REFERER} http://www.htmletc.net/
RewriteRule ^(.*)$ http://www.htmletc.net/

For example. And when linked off of other sites that I do not specify within .htaccess it works great, not allowing the image that is linked off my site to be shown on the other site. When I view my main site w/ Netscape (my main site is specified to allow to link off of the images), everything is great. But when I view it w/ IE, none of images appear. Any ideas or help would be greatly appreciated.

Have you tried -> http://www.apache.org/docs/misc/rewriteguide.html ?


Per your example, I would do something like this:


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.htmletc.net/.*$ [NC]
RewriteRule .*.gif$ - [F]
RewriteRule .*.jpe?g$ - [F]

I don't see your RewriteRule trying to block anything without the [F].

[This message has been edited by freebsd (edited September 04, 2000).]

Thanks, I'll look at that and put it into effect to see if I can get it to work correctly. You're help is much appreciated.

http://www.devshed.com/Talk/Forums/smile.gif

I tried editing this code and using it myself. I have a serious problem of people pirating media clips on my site. It adds a lot of traffic from which other sites get the visitors.

Do I just put it into my media folder in an .htaccess file? In the above example, I just put my url in and dropped the htaccess file in my images dir. I was able to continue pirating stuff.

Anything to add for a desperate person?

Put that .htaccess in your media directory to avoid unneccessary server load. If you place it in your docroot dir, the .htaccess file will be read for any requests of your site.










privacy (GDPR)