PDA

View Full Version : How to protect pics?


Lush
03-08-2001, 07:51 PM
Does anyone know the htaccess code to protect your pics? I saw it posted a week ago or so but can't find the post.

I would greatly appreciate it.

Shannon
03-08-2001, 09:19 PM
RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://.*domain.com/.*$ [NC]
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.domain.com


Best Of Lcuk http://bbs.adultwebmasterinfo.com/ubb/smile.gif

jayeff
03-08-2001, 10:12 PM
That's a fairly vulnerable code. It is safer to put your pics (or anything else you want to protect) into directories and use an htaccess like this:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://www\.yourdomain\.com/ [NC]
RewriteCond %{HTTP_REFERER} !^http://yourdomain\.com/ [NC]
RewriteRule /* http://%{HTTP_HOST}/ [R,L]

That last line will send them to your domain's default page. If you want to send them somewhere else if they try to hack, use this for the last line:

RewriteRule /* http://www.anydomain.com/anypage.html [L]