开发者

Make all website's folders inaccessible

I have a webpage online. When I type an address the browser will look for the index.html of that folder. If it doesn't it'll just list it's contents. I don't want the browser to show the contents, I want it to, for example, just show a blank page.

Some of these folders store files that are referenced as downloads on other pages of my website, so the some contents of the folder need to be downloadable, though I don't want them to be visible. So to download a specific file the user must know the entire path. If they are listed, he/she is immediatel开发者_JAVA技巧y aware of all files I have there and therefore can download them.

The way I worked this around was to put a blank index.html on each of the folders I want to have this behavior. But this is a pretty dumb solution. Is there a way to like change the permissions of the folder so that it's contents cannot be listed but still be downloadable?


Disable directory browsing using .htaccess:

  • Open your .htaccess file
  • If a Options Indexes line exists, change it to Options -Indexes. Otherwise add Options -Indexes as a new line.

Found in http://www.techiecorner.com/


This depends on what web server you're using, IIS, Apache, etc. You need to turn off directory browsing.

Enable or Disable Directory Browsing in IIS 7 http://technet.microsoft.com/en-us/library/cc731109%28WS.10%29.aspx

How to disable directory browsing , APACHE http://www.felipecruz.com/blog_disable-directory-listing-browsing-apache.php

If you can't edit the configuration directly, then the easiest thing to do is put an index.html file in the directory that is blank or redirects somewhere else.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜