Jump to content

Recommended Posts

Hi,

 

I was wondering if anyone can potentially help me on this one. I'm not so hot with htaccess/apache so any help would be hugely appreciated!

 

Okay..

So i'm serving a selection of files from my website, but want them restricted so that no one can go to the file and download it.

I've currently got that working via this code:

 

SetEnvIf Referer mywebsite\.com localreferer
SetEnvIf Referer sub.mywebsite\.com localreferertwo
SetEnvIf Referer subtwo.mywebsite\.com localrefererthree

<FilesMatch \.(eot|woff|ttf|svg)$>
Header add Access-Control-Allow-Origin "*"
Order deny,allow
Deny from all
Allow from env=localreferer
Allow from env=localreferertwo
Allow from env=localrefererthree
</FilesMatch>

 

This currently works, and going to the location of an eot, woff etc is presented with a 403 forbidden warning, yet when my website (or sub domains etc) calls the files, it all displays them correctly etc. Hoorah!

 

However, when I call these files from another server, it allows the files to be displayed. How can I prevent this from happening?

I would of course like to be able to maybe make an exception for one or two websites, but generally I don't want others being able to use my files.

 

I thought I may be able to do this via hotlink prevention, however this resulted in problems displaying it on my own site for some reason.

 

If anyone can help that'd be great.

 

Thanks,

Edd

Link to comment
https://forums.phpfreaks.com/topic/260024-restricting-files-folders-etc/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.