mr_bob Posted July 21, 2021 Share Posted July 21, 2021 Hi, If I want to use file in html, so that <div> tag will have a property 'data_url' of that file like <div class="something" data_url="actualFile.txt" but at the same time blocking direct access to file so that nobody can just type path in browser and download it, it's possible to block it in .htaccess config file? That would theoretically make it unusable but I don't know for sure. It sounds a bit silly but maybe there's a way to block direct access to file at least to a moderate degree. Any useful manual regarding this topic to read? Quote Link to comment https://forums.phpfreaks.com/topic/313406-block-direct-access-to-files-but-use-them/ Share on other sites More sharing options...
Solution kicken Posted July 21, 2021 Solution Share Posted July 21, 2021 Some places will try and do that by checking the referrer and denying access if it doesn't exist or match the right domain. It's not going to stop anyone with even the slightest determination from downloading your file though. IMO, it's not worth the effort to even try and do something like that. Basic rule of the web is if the browser needs access to the file, then by necessity the user can also download a copy of that file. Quote Link to comment https://forums.phpfreaks.com/topic/313406-block-direct-access-to-files-but-use-them/#findComment-1588462 Share on other sites More sharing options...
mr_bob Posted July 21, 2021 Author Share Posted July 21, 2021 This is what I was looking for, thanks for the link. Quote Link to comment https://forums.phpfreaks.com/topic/313406-block-direct-access-to-files-but-use-them/#findComment-1588465 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.