0
I need to block direct access to files in a directory, for example public_html/repositorio.
In this folder (repository) contains images (jpg), pdfs etc.
I don’t want anyone to directly access this folder (listing its content) or directly access one of the files via www.meusite.com.br/repositorio/abc.jpg
I used in the . htaccess file the following command: Options -Indexes. It blocked the file listing when I input www.meusite.com.br/repositorio/, but allows me to access the file directly.
IMPORTANT: I already used the command Deny from all on htaccess and it blocked access to the file. But when I access my site, the image also does not open...
Thanks for the help.
What you need to do is block only hotlink to the image, ie taking your site any other would be blocked. and for that there is this solution: How to Block Image Hotlinks with Warning?
– Danilo
Thanks for the help, but it didn’t work out. My . htacess is like this, what could be wrong? Options -Indexes Rewriteengine On Rewritecond %{HTTP_REFERER} ! http://(.+.)? peticoes.tecologia.Ws/ [NC] Rewritecond %{HTTP_REFERER} ! $ Rewriterule . *.(jpe?g|gif|bmp|png) $ [L] Please note that http://peticoes.tecnologia.ws/repositorio/imagem_principal/ is blocking the listing, but http://peticoes.tecnologia.ws/repositorio/imagem_principal/140800001.jpg presents the image...
– Rafael Schaffer Gimenes
puts your code in the question, gets better to see
– Danilo