Prevent user directly accessing files inside specific folder using .htaccess

Viewed 16

I want to prevent users from directly accessing specific folder files by hitting URLs in browsers like https://sampledomain.com/folder/1.jpg.

For that I implemented this code in .htaccess

<FilesMatch "\.(jpg|png|txt|zip|rar|)$">
 Order Allow,Deny
 Deny from all
</FilesMatch>

But It applied to all the directories available inside my server. I want to prevent user from directly accessing specific directory files.

Can anyone please help with the same?

0 Answers
Related