...

View Full Version : I need help with htaccess



kornhead
01-12-2003, 03:38 AM
Ever since I put videos and mp3s on my site lots of other sites have linked them which in turn uses up my bandwidth. I was told by my host that I could block access from certain ips or urls by adding

order allow,deny
deny from www.korni.by.ru
deny from www.geocities.com/kornheavymetalenglish
allow from all

to my .htaccess file. When I did that I went to the sites that should have been blocked from my site and I was still able to download my videos and mp3s that they had linked off of my site. Please help me I can't afford to have these people using up all my bandwidth.

jkd
01-12-2003, 04:06 AM
http://www.javascriptkit.com/howto/htaccess10.shtml

? :)

kornhead
01-12-2003, 04:47 AM
I also tried putting the below in my .htaccess but that also did not work.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.kornhead.net/.*$ [NC]
RewriteRule \.(mp3|jpg)$ - [F]

jkd
01-12-2003, 05:04 AM
Ok, I'm no .htaccess expert, but shouldn't something like:

order deny,allow
allow from www.kornhead.ne
deny from all

work?

kornhead
01-12-2003, 05:43 AM
Didn't work. It blocked everyone.

Spookster
01-12-2003, 08:42 AM
Dont waste your time doing it with htacess. In order to protect the files you have to use HTTP_REFERRER however that information is given to the server from the users browser. Not all browsers give that information or give it correctly or allow people to change it.

Put the files in a non-web accessible directory and store the paths in a database then in the pages the links for the files will run through the database which you can then control and people can't hotlink.

orchidred
01-19-2003, 10:01 PM
I have been having a similar problem with my .htaccess file. I also want to disable hotlinking, for which I used the following code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]

When I use this though (which I believe is written correctly) my server then blocks my own domain as well. Hence, none of the images on my site work if I try and disable hotlinking. I contacted the support people at my server, and they just told me that their system randomly rewrites htaccess files. Is that normal?

I would like to know more about protecting files by putting them in a non-web accessible folder, as states below:

"Put the files in a non-web accessible directory and store the paths in a database then in the pages the links for the files will run through the database which you can then control and people can't hotlink."

Im guessing this is some form of PHP script? Or? If someone could post a tutorial link for how to accomplish this that would be great. The tutorial would have to be rather detailed though since I have no idea how to write PHP.

Any help is appreciated. Much as I ask people not to direct link to media on my site, everyone does! :(

pb&j
01-28-2003, 09:59 PM
Originally posted by kornhead

order allow,deny
deny from www.korni.by.ru
deny from www.geocities.com/kornheavymetalenglish
allow from all


Try taking off the www part (leaving the first period though).

order allow,deny
deny from .korni.by.ru
deny from .geocities.com/kornheavymetalenglish
allow from all

pb&j
01-30-2003, 01:28 AM
Originally posted by kornhead
I also tried putting the below in my .htaccess but that also did not work.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.kornhead.net/.*$ [NC]
RewriteRule \.(mp3|jpg)$ - [F]

You have to find out from your web host if they support mod_rewrite. Some hosts do not and thus this attempt would fail.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum