|
|
Dan Byers wrote:
> I have this little bit of code in the .htaccess file in my /img directory on my
> website, the purpose of which is to keep people from hotlinking onto any GIF
> files (btw we're talking about Apache):
>
> RewriteEngine on
> RewriteCond %{HTTP_REFERER} !^$
> RewriteCond %{HTTP_REFERER} !^http://mydomainname.com/.*$ [NC]
> RewriteCond %{HTTP_REFERER} !^http://www.mydomainname.com/.*$ [NC]
> RewriteRule .*\.gif$ - [G]
>
> I would like to add the capability to prevent JPG or PNG hotlinking as well.
> Anyone know how to do that? Do I copy everything from the first RewriteCond
> thru the [G], and just supply the new file type instead of .gif? Any help
> would be appreciated. Thanks :)
>
> --
> Dan
> GoofyGraffix.com
>
>
>
Try:
RewriteRule .*\.(gif|jpg|png)$ - [G]
(Disclaimer: I'm by no means an expert on MOD_REWRITE, if you webserver
acts strangely after the suggested changes, don't blame me, you changed
your file.)
Post a reply to this message
|
|