Reputation: 100205
I'm having problem with htaccess. what I want to do is when a user accessed my folder named images
from a browser I want to restrict it, but when accessing image files inside it, I want to display the image in the browser. Tried the following code but no success.
<FilesMatch "\.(gif|jpe?g|png|pdf)$">
Allow from all
</FilesMatch>
<Directory>
Order deny,allow
Deny from all
</Directory>
So, can you please suggest something?
Upvotes: 2
Views: 7331
Reputation: 13521
You can simply add an empty index.html. This will stop the direct access to that folder.
Another solution is that:
Options -Indexes
Enter the above code into htaccess. That will produce a 403 HTTP Status code on folder access, but will allow you do share the content !
Upvotes: 10