2011-08-09 31 views
6

我已激活目录与这条线在.htaccess上市:允许目录只列出了IP

Options +Indexes 

如何限制这只是一个IP地址具有访问所有文件/目录中每个人(每个IP)?

回答

4

未测试:

allow from all 
Options -Indexes 
<Files *> 
deny from all 
allow from 195.112.15.4 
Options +Indexes 
</Files> 

这样的Options +Indexes将仅适用于IP 195.112.15.4

+0

我知道这个片段,但不适合我。我无法访问具有不同IP的文件。 我只是不喜欢目录收听 – Xaver

0

我知道这是一个古老的线程,但正如我刚才发现的东西,似乎工作,我我决定在这里分享。

添加这似乎这样的伎俩:

<Files .> 
    Order Deny,Allow 
    Deny From All 
    Allow From 195.112.15.4 
</Files> 
0

这是我得到了什么工作对我来说,这是我不希望每个人都能够列出文件夹内的.htaccess,但如果我给他们一个链接到里面的文件,我希望任何人(所有)都能够下载链接。

allow from all 
Options -Indexes 

<Files *> 
    deny from all 
    allow from all 
    Options -Indexes 
</Files> 

<Files .> 
    Order Deny,Allow 
    Deny From All 
    Allow From xx.xx.xx.xx 
    # put the IP you want to allow indexing for above here 
    Options +Indexes 
</Files>