Disable directory listing on apache; but access to individual files should be allowed

前端 未结 5 2000
夕颜
夕颜 2021-01-31 19:28

I do not want to use .htaccess. How should I change my Directory attributes?


   ServerName abc.com
   DocumentRoot /usr/share/uploads
           


        
5条回答
  •  南旧
    南旧 (楼主)
    2021-01-31 19:43

    The easiest way would be to put an empty index.html (or whatever you apache is configured to deliver by default) inside that directory. This is not a real solution but a very simple workaround. The user browsing that directory would just see a blank white page.

    Further you could use a script (like index.php) wich emulates the directory-listing and only shows some special files.

提交回复
热议问题