As my title is saying I want to create .htaccess which is hosted on subdomain. Website is very simple - 5 pages big, coded in HTML and CSS (no Wordpress or any other platform). What I need... 1. Want to prevent people accessing my image or any other folder For example my website is: dogs.example.com and I don't want that people are able to go to dogs.example.com/images. Instead I want to block them when they type that kind of URL and redirect them to my hompage. 2. Need lines to prevent image hotlinking too... 3. How to make my website using gzip effectively I am using shared Hostgator plan so I am able to edit my .htaccess files. Thx in advance for any help!
I would recommend just putting an index.html file in your images directory. And then adding a <meta> refresh tag or JavaScript document.location to redirect them to your home page. If all else fails they still won't be able to see your whole image directory. Unless you're running a fairly large site or got completely boned on bandwidth with the hosting plan you purchased (or got for free) I wouldn't worry about it. Not that many people are going to try to steal your images without downloading them for themselves and uploading them to their own server. However, if you're really worried about it, if I'm not mistaken HostGator has a function in the cPanel to disable hot linking images which works somewhat effectively if I remember correctly. I'm not really sure what the third question is asking
There is a directive called NoIndex in Apache .htaccess file, which will stop the server from showing any directory listing in your site. Maybe that will help you with point 1.
Don't worry so much about people accessing your images directly. If you don't want them to view the directory listing you can simply add a blank index.html file or like vishals suggested use htaccess. Don't worry about hot linking to your images.. that really was only a concern 10 years ago when web hosts only gave you 25 MB of space and 100 MB of bandwidth.