The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group
Prevent downloading of your files by URL
Edit the .htaccess file located at the root of your site and copy this code at the end:
# BEGIN Protect
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
RewriteRule . - [F] [L]
# END Protect
If you don't have an .htaccess file, create it.
Replace "www.mysite.com" by your domain.
Your users and you will always have access to your files by your site but it will not be possible to download them by their URL.
If you do tests do not forget to clear the cache of your browser.
My knowledge is limited in this domain, suggestions from pros are welcome.
There are only 2 plugins for managing user access: "Advanced Access Manager" and "User Access Manager" (more oriented Group)
July 8, 2017 at 8:12 am
The code you provided above will make everything forbidden and throw a 403 server response. If you want to prevent files from being downloaded, you need to be a lot more specific in your rewrite rules, otherwise you will create unforeseen consequences.
Also, .htaccess is only for servers running Apache. There are many other web servers out there where .htaccess won't work at all.
Last, you would be better off protecting your content with a plugin like s2member, rather than messing with permissions at the server level.
July 8, 2017 at 8:31 am
Thank you for your intervention and for your clarification.
If S2Member can prevent direct download by the URL, I would appreciate your support to put it into practice.
Regards
July 8, 2017 at 12:51 pm
We can discuss it. Please fill out my project inquiry form: https://victorfont.com/project-inquiry/
July 9, 2017 at 1:31 am
I already have the Advanced Access Manager plugin which is of excellent quality and very efficient.
My goal here was to bring a free and functional solution that I personally used without any problem. The code presented can probably be enriched and it would be great!
Thank you very much for your constant advice and support.
July 15, 2017 at 3:19 am
FP creates the same .htaccess file to protect the files when "Protect all files uploaded in the form" is checked.
Discussion closed.