I have a folder in my public directory that contains some pdf files and images. The structure is similar to the one below:
-public
-documents
-images
-image1.jpg
-image2.jpg
-pdf
-pdf1.pdf
-pdf2.pdf
I have created a rest web service that gets all the contents in the folder 'documents' and displays them on a page which can only be accessed by logged users.
For e.g a logged user can view 'pdf1.pdf' with the following url:
http://localhost:8000/documents/pdf/pdf1.pdf
The issue is that if the user is now logged out and try to access that same url directly, he's still able to view the file.
Is there any way by using laravel or htaccess to prevent this when the user is not logged in?
Thanks!