Apache - allow directory listing but downloading files require vaild-user

654 Views Asked by At

I want to allow my friends to view all files in directory without logging . But when they want to download file I want to authenticate them. How to do this ?

Now I have something like this:

AuthUserFile /var/....../.htpasswd
AuthName "VIP"
AuthType Basic
require valid-user
1

There are 1 best solutions below

0
On

You could use a FilesMatch rule.

Take a look at The Ultimate .htaccess Guide for more information.