.htaccess help please


#1

i know this must be really basic but for some reason i cant get it to work. Can someone please type up what i need to prevent hotlinking so i can just copy and paste it into notepad

my site name is www.kittenimage.com, in my main directory (/kittenimage.com) i have a .jpg image named hotlink which i want shown in place of the hotlinked image below is what i have in my .htaccess file but its not working

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?kittenimage.com/.*$ [NC]
RewriteRule .(gif|jpg)$ http://www.kittenimage.com/hotlink.jpg [R,L]

Also shouldnt the .htaccess file on my server be hidden so i cant see it with my ftp program? because mine is not although i may have 2 on there 1 hidden 1 not? how do i delete the hidden file if i cant see it? Sorry for so many questions hope someone can point me in the right direction


#2

Yes and no. There is a convention of “hiding” files from being listed that begin with a period, and it is not builtin to the filesystem itself. The programmer gets to decide whether or not to follow this convention and how. Some programs make it optional and require that you specifically choose to show these files.

As for as FTP goes - regular FTP is not the same as using secure FTP (SFTP using SSH2). On DreamHost, if you use regular FTP, you have to configure your FTP client to use the switch that tells the FTP server to include the “hidden” files in a directory listing. I’ve observed that with SFTP these files are always listead.

For example, I am using CuteFTP Pro. It has a “Server-side filtering” setting that allows me to tell it use the command “LIST -a” instead of just “LIST”. The “-a” is a switch that tells the FTP server to include the “hidden” files. But I don’t need to set that if I use SFTP instead of FTP.

:cool: Perl / MySQL / HTML+CSS


#3

I created wiki page that descibes many different ways of preventing hotlinking. You should find most of the information you need in there.


Simon Jessey
Keystone Websites | si-blog