Reputation: 71
I want to protect my files on the server from being downloaded but they need to be able to be accessed from/by the server, I was wondering if that would be possible with htaccess. I mean files like "font files", "images" etc.
I have tried the above but without luck. If you know a solution with htaccess or any other way, please reply!
Upvotes: 0
Views: 196
Reputation: 38253
One way I can see this working, is if you are using a server-side language, like PHP, you could do something like this in your HTML pages:
<!-- Your font(s) -->
<link href='http://yoursite.com/font-file?request-token=a3DdsS2n89SDF4sdf345' rel='stylesheet' type='text/css'>
where you create some unique token in the URL, that you automatically generate, with PHP, every time you serve an HTML page, and then save that token on the server. Then use another PHP script to serve the font file, that authenticates the token in the URL via $_GET['request-token']
, etc. If you only allow a token to be used once, before refusing any further requests for it, you can embed the font in your HTML and any user attempts at downloading it afterwards will fail.
This isn't a completely bulletproof method, but will deter the majority of attempts to steal your font assets, etc.
Upvotes: 1