Forum Moderators: phranque

Message Too Old, No Replies

my bandwidth is leeching, need help!

         

kia0047

3:57 am on Oct 21, 2003 (gmt 0)

10+ Year Member



Hi,
My bandwidth is leeching, can someone help me how to put up a .htaccess file properly so that i can block those hotlinkers.

I read thru many websites about htaccess but i still cannot get it works on my website. My main problem is: i uploaded a htaccess file to my images directory but somehow, i cannot view all the images myself!

Does anyone know where is my error? I have uploaded it with ASCII mode and replace "abcd.com" with my own domain name. see below:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://(www\.)?abcd.com/.*$ [NC]
RewriteRule ^.*$ [abcd.com...] [R,L]

jdMorgan

4:15 am on Oct 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



kia0047,

Welcome to WebmasterWorld [webmasterworld.com]!

Assuming that you have spaces between the characters "}" and "!" as shown below, and that this code is in .htaccess in your images directory, and that only images are in that directory (no html, and no scripts), then your code should work. It is not perfect, but it should work.

However, if you want to save bandwidth, I suggest you modify the code to simply return a 403-Forbidden response instead of a substitute image:


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

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim

kia0047

4:52 am on Oct 21, 2003 (gmt 0)

10+ Year Member



Thanks Jim.
My directory contains purely jpg files. i have changed the htaccess accordinly. but doesn't work as what i expected.

Perhaps, I shouldn't say my htaccess doesn't work, sorry to confuse you. my htaccess works so well as it blocked everybody away including ME, MYSELF can't view the jpg files in the directory .....>_<....

p/s: my jpg files are stored inside a sub-sub-folders. does this matter?

my jpg file location:
[abcd.com...]

"photo" directory is where i store all my jpg files.

whenever i uploaded the htaccess file to "photo" directory, i cannot view the jpg files.