I
I
Ivan2017-09-12 23:14:21
htaccess
Ivan, 2017-09-12 23:14:21

How to block access to files from the browser?

I was able to block access to one file using .htaccess

<Files 1.txt>
Deny from all
</Files>

and how to close access to 3 files in one directory?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2017-09-12
@9StarRu

<FilesMatch ^(1\.txt|2\.txt|3\.txt)$>
Deny from all
</FilesMatch>

Through mod_rewrite - the easiest way.
RewriteEngine on 
RewriteRule (1\.txt|2\.txt|3\.txt)$ - [F]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question