Forum Moderators: phranque
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]
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]
Jim
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.