A
A
Alexander Interesting2021-06-13 12:10:24
PHP
Alexander Interesting, 2021-06-13 12:10:24

How to prevent file navigation through a direct link, but only through PHP: fopen('file.ext', 'r')?

I have a users.json file and I need to be able to read it through fopen, but following a link to it should be prohibited. How can you do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-06-13
@Swimergg

Put .htaccess in the folder with the file

<Files "users.json">
    deny from all
</Files>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question