2016-01-18 17 views
0

目錄我已經在我的.htaccess中的以下內容:排除從mod_autoindex.c選項-Indexes

# "-Indexes" will have Apache block users from browsing folders without a 
# default document Usually you should leave this activated, because you 
# shouldn't allow everybody to surf through every folder on your server (which 
# includes rather private places like CMS system folders). 
<IfModule mod_autoindex.c> 
    Options -Indexes 
</IfModule> 

不過,我有沒有一個索引文件的目錄(我寧願保持這種方式),我需要啓用訪問權限。如何從上述代碼中排除此目錄?

+0

我的答案解決了您的問題嗎?如果是這樣,我會很感激,如果你可以將它標記爲已接受和/或提高它,所以我得到了信譽,其他人在未來閱讀這篇文章,看到它解決了它。謝謝 – sa289

回答

0

儘管下面的評論(我是從別人的代碼):

# "-Indexes" will have Apache block users from browsing folders without a 
# default document 

...此代碼不會阻止用戶訪問沒有索引文件的目錄中的文件。因此,我不需要從上面的代碼中排除我的目錄。

作爲示例,example.com/testdir沒有索引文件。但是,我可以訪問example.com/testdir/testfile.txt

1

創建在該目錄中的.htaccess文件,並在其中把下面

<IfModule mod_autoindex.c> 
    Options +Indexes 
</IfModule> 
相關問題