日韩精品成人无码专区免费-国产99久久久久久免费看-国产精品丝袜久久久久久不卡-国产精品无码一区二区三区

php如何禁止列目錄

發布時間:2024-05-09 點擊:171
php禁止列目錄的實現方法:首先找到并打開“httpd.conf”文件;然后在“options indexes followsymlinks”的“indexes”前面加上“–”符號;最后保存修改即可。
推薦:《php視頻教程》
apache中禁止顯示目錄文件列表的配置方法
假如你輸入一個虛擬目錄的地址:http://localhost:8080/b/
如果該虛擬目錄下沒有 index.html,瀏覽器也會顯示該虛擬目錄的目錄結構,列出該虛擬目錄下的文件和子目錄。
如何禁止 apache 顯示目錄列表呢?
要禁止 apache 顯示目錄結構列表,只需將 option 中的 indexes 去掉即可。
比如我們看看一個目錄的目錄配置:
<directory "d:/apa/blabla"> options indexes followsymlinks #----------> options followsymlinks allowoverride none order allow,deny allow from all</directory>你只需要將上面紅色代碼中的 indexes 去掉,就可以禁止 apache 顯示該目錄結構。用戶就不會看到該目錄下的文件和子目錄列表了。
indexes 的作用就是當該目錄下沒有 index.html 文件時,就顯示目錄結構,去掉 indexes,apache 就不會顯示該目錄的列表了。
如果這樣設置可能還是會顯示目錄列表:
<directory / > options followsymlinks allowoverride none order allow,deny allow from all</directory>第二種方法
編輯httpd.conf文件編輯httpd.conf文件
vi ./conf/httpd.conf找到如下內容:
……<directory “c:/program files/apache2.2/htdocs”> # # possible values for the options directive are “none”, “all”, # or any combination of: indexes includes followsymlinks symlinksifownermatch execcgi multiviews # # note that “multiviews” must be named *explicitly* — “options all” # doesn’t give it to you. # # the options directive is both complicated and important. please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # options indexes followsymlinks # # allowoverride controls what directives may be placed in .htaccess files. # it can be “all”, “none”, or any combination of the keywords: # options fileinfo authconfig limit # allowoverride none # # controls who can get stuff from this server. # order allow,deny allow from all</directory>……在options indexes followsymlinks在indexes前面加上 – 符號。
即: options -indexes followsymlinks
【備注:在indexes前,加 代表允許目錄瀏覽;加 – 代表禁止目錄瀏覽。】
這樣的話就屬于整個apache禁止目錄瀏覽了。
如果是在虛擬主機中,只要增加如下信息就行:
<directory “d:\\\\test”> options -indexes followsymlinks allowoverride none order deny,allow allow from all</directory>這樣的話就禁止在test工程下進行目錄瀏覽。
備注: 切記莫把“allow from all”改成 “deny from all”,否則,整個網站都不能被打開。
還有一種方法:
可以在根目錄的 .htaccess 文件中輸入
<files *>options -indexes</files>就可以阻止apache 將目錄結構列表出來。

有哪些郵件群發軟件推薦
COVID
如何取消電腦IE瀏覽器中允許對剪切板進行訪問的提示
鞍山如何注冊商標
網址注冊可以在哪個平臺注冊?
上海備案填寫了驗證碼怎么提示還是提示沒有網站負責人的照片
農產品發現新機遇?網站建設助力轉型
云服務器配置1核夠