It depends on how sensitive the data is that you are trying to hide.
Very sensitive data shouldn’t be stored on a front end web server. Things like Bank account data, SSN, even personal identity data should be handled with much care. Usually, Organizations that keep that kind of information should store the data on at minium a “middleware” server that is behind firewalls and can only be accessed through authorized processes (PHP, ASP, etc.) running on the webserver.
That is very true, but the individual would need to have the full URL, including the filename. Pagesafe isn’t designed to Protect assets but to protect web pages from being viewed. Also, you should consider search engines indexing these assets.
If your site is showing a directory listing, you have a much bigger security issue going on. A good web hosting companies should have that turned off by default. It’s a simple Directive in both Apache and Ngnix.
Since most sites are using Apache and Nginx usually doesn’t allow local directives like htAccess, if the host doesn’t already have the index listing disabled than add this to your htaccess file:
# Disable directory browsing
Options -Indexes
Now, if you add this line and someone tries to get a directory index listing to browse (https://example.com/resources/), they’ll get 403 Forbidden message.
Turning off indexes should be set for every website out there!
If the data isn’t that sensitive, you could simply add the lines above to htaccess and then create a directory inside resources and give it a “hard to guess” name like r2b24c1nlx0j35xy2hh rename the resource file to another hard to guess name like l6dbn7918ekcorxvyx4.pdf. Then someone would have to know the URL:
https://example.com/resources/r2b24c1nlx0j35xy2hh/l6dbn7918ekcorxvyx4.pdf.
Not likely, and they wouldn’t be able to browse the directory.
There is another product for membership sites called SiteLok. It integrates well with RW and has the option to protect assets.
You can protect files and websites with .htaccess and .htpasswd files. It will protect anything in a directory, but it’s difficult to manage. More can be found here if you want to try that.
https://www.groovypost.com/howto/htaccess-password-protect-apache-website-security/
Now, as far as search engines, if you use Sitelok or the htaccess method, anything that is protected won’t get indexed.
If you keep the resources in the resources folde,r there is a chance that they might get indexed. So you might want to add a robots.txt file to request search engines not to index the sub-directory.
You can search on this for examples :
robots.txt disallow directory