How do I disable directory browsing?

后端 未结 12 603
灰色年华
灰色年华 2020-11-22 08:35

I want to disable directory browsing of /galerias folder and all subdirectories

Index of /galerias/409

* Parent Directory
* i126937298         


        
12条回答
  •  一生所求
    2020-11-22 09:22

    To complete @GauravKachhadiya's answer :

    IndexIgnore *.jpg
    

    means "hide only .jpg extension files from indexing.

    IndexIgnore directive uses wildcard expression to match against directories and files.

    • a star character , it matches any charactes in a string ,eg : foo or foo.extension, in the following example, we are going to turn off the directory listing, no files or dirs will appear in the index :

      IndexIgnore *

    Or if you want to hide spacific files , in the directory listing, then we can use

    IndexIgnore *.php
    

    *.php => matches a string that starts with any char and ends with .php

    The example above hides all files that end with .php

提交回复
热议问题