Okay, so I tried, I really did. The closest I got to something that sort of works, is creating a
dl-file.php file in root of my site, and putting this in it:
I tried posting code, but BHW often just throws an error. It's PHP code, I wrapped it in PHP tags, but the forum won't let me post and I don't know why. The code is at the top of this page -
https://gist.github.com/hakre/1552239
And then this in htaccess:
Code:
# BEGIN DL-FILE.PHP ADDITION
RewriteCond %{REQUEST_FILENAME} -s
#Protecs only wp-content/uploads/ultimatemember. Add more RewriteRules as needed
RewriteRule ^wp-content/uploads/2022/(09/.*)$ dl-file.php?file=$1 [QSA,L]
#Protect all inside wp-content/uploads, comment it out if your website is fully private
#Please note that the order matters, so, that's why the previous rewrite must go before
#RewriteRule ^wp-content/uploads/(.*)$ dl-file.php?file=$1 [QSA,L]
# END DL-FILE.PHP ADDITION
And this sort of worked, but then trying it on various browsers, sometimes I could still get to download the zip file. These are browsers that have never been logged into the site, or any site.
And then I tried logged in, and I'm allowed to download one zip file, but I get redirected to the homepage when I try to download another.
---
Anyway, even if I got this to work, it would still only work for users that are not logged in. But registering on the site takes less than a minute. So it's only protection against really really lazy people.
I tried google, I got no replies here, I tried plugins, can't get this one done. All I wanted is for people that receive a zip file on the order page or private messages within the site to be able to download them, and anyone else not to be allowed to.
I'm pretty sure that there is no way for someone to navigate my site and find the download links somehow. My sitemap doesn't show them. And since I categorize uploads into dates on the site, someone would really need to get the year and the month and the exact filename and extension, to be able to download something. I guess, if someone is slick enough to do it, they beat the weak protection, and let them have it. What can I do...
Enough time wasted on this. Some things you either let go or pay someone to do for you. We're gonna let go of this one.
Stupid ass wordpress
