Block files so only logged in users have access

Asked

Viewed 109 times

0

I have a folder structure mounted as follows:

System - data - css - Connections (database) - images

In the data folder I make the files available for authenticated users to download. However, if I put in the address bar, for example, www.meusite/sistema/dados/usuario1/documento1.pdf, it downloads normally without being logged in. I have tried to block by .htaccess, but it blocks everything and not even the logged-in user can download.

How can I solve this problem by giving access only to logged in users?

1 answer

0

When you consult this URL, you can do a validation if the user is valid and logged in. If so, download. If not, redirect to the home page or something like.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.