P
P
Parrot10242018-06-12 00:21:56
htaccess
Parrot1024, 2018-06-12 00:21:56

How to block access to PDF files from the browser?

And so I load everything into a special directory
../public_html/wp-content/uploads/securepdfs
. There, all PDFs are put into folders by year and month of
2018, and there inside, for example, 05, 06, etc.
The folder already has htaccess like this - one craftsman wrote

Options -Indexes
Deny from all
<FilesMatch '\.(jpg|png|gif|mp3|ogg|pdf)$'>
Order Allow,Deny
Allow from all
</FilesMatch>

And also the index.php file
<?php
// This file is intentionally blank.

5b1ee859180f3972493309.jpeg
Alas, damn it, when you insert a direct link in an anonymous tab, the file opens perfectly.
5b1ee7c13b15c896225484.jpeg
Actually, maybe from somewhere above comes permission like let them open what they want, I will be glad if you tell the illiterate how and what

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
deyen, 2018-06-12
@deyen

Set permissions to 700 - in this case, only the owner of the files will have access.
Apache will display 403 Forbidden for others

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question