Web Hosting Talk







View Full Version : Problems with a .htaccess file


Cymedia
05-09-2002, 07:39 PM
I have the following code:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/.*$ [NC]
RewriteRule .*\.(avi|AVI|gif|GIF|jpg|JPG)$ - [F]

and i want to protect my movies so they dont be hot link.
But when i upload this i can't download the movies.
Any solutions??

(SH)Saeed
05-09-2002, 08:25 PM
I don't know if the rest of the code is correct, but I do see this error:

RewriteCond %{HTTP_REFERER} !^http://www.http://www.mydomain.com/.*$ [NC]

Seems like you have typed in http://www. twice..

GHDpro
05-10-2002, 09:51 AM
I use the following code which seems to work fine:
SetEnvIfNoCase Referer "^http://www.mysite.com" local_ref=1
SetEnvIfNoCase Referer "^http://mysite.com" local_ref=1
SetEnvIfNoCase Referer "^http://server_ip_address" local_ref=1
SetEnvIf Referer "^$" local_ref=1
<FilesMatch ".(exe|zip|txt|EXE|ZIP|TXT)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>
Note: you probably need to edit the file extensions though.
As you can see my file downloads are mostly exe & zip files.