Allow directory listing for IP address only

I activated the directory listing with this line in .htaccess:

Options +Indexes 

How can I limit this to only one IP address, having access to all files / directories for each (each IP)?

+6
source share
3 answers

Not tested:

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

Therefore, Options +Indexes will only be valid for IP 195.112.15.4

+4
source

I know this is an old thread, but since I just found something that works, I decided to share it here.

Adding this seems like a trick:

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

This is what I worked for me, this is .htaccess inside the folder that I don’t want everyone to be able to list, but if I give them a link to the file inside, I want anyone (everyone) to be able to download the link.

 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> 
0
source

Source: https://habr.com/ru/post/894654/


All Articles