Jump to content

Block direct access to files but use them


Go to solution Solved by kicken,

Recommended Posts


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?

Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.