Not sure if my question would make sense or not. I have created a sub-domain to store some of my static files (like images). So, some images now load from http://imgs.example.com/imagefilename.png

Now, the problem is, all the files stored under this sub domain http://imgs.example.com/ are publicly visible which I want to hide or redirect or show 404. Any idea how to achieve this?

Currently files in the subdomain shows --

Index of /

  • cgi-bin/
  • onevideofile.mp4
  • oneimagefile.png

Apache Server at imgs.iconicwebteam.com Port 80


You could go around and not allow indexes?

Add this to a .htaccess file, in the same directory as the .png and .mp4 files.

Options -Indexes 
| improve this answer | |
  • thanks man. it worked like a charm. Now the directory is showing 403 errors.. :) – kalyan Jun 19 '14 at 6:22
  • Or put an empty index.php in that directory, or with modified headers to show 404? – Frederik Spang Jun 19 '14 at 8:36
  • hmm. not a bad idea though.. which one will better.. working with htaccess file or putting a blank index file @frederik spang – kalyan Jun 19 '14 at 8:42
  • They'll do essentially the same - Index shows 404, and .htaccess will give a 403. Either way, the directory index will be gone. – Frederik Spang Jun 19 '14 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.