artaylor Posted June 16, 2017 Posted June 16, 2017 Hi, I am trying to password protect a subfolder (not used by PW installation) using standard .htaccess and .htpasswd. However, the main .htaccess file in PW is creating a 404 error. If I disable the main .htaccess, it works. My knowledge of .htaccess and rewrite rules is very limited and nothing I have tried has allowed this to work. All suggestions welcome. Thanks
Sergio Posted June 16, 2017 Posted June 16, 2017 Did you try the http://modules.processwire.com/modules/fieldtype-secure-file/ module? 1
Robin S Posted June 19, 2017 Posted June 19, 2017 @artaylor, I tested this and PW does not interfere with htpasswd protection of a folder in the site root. Your folder structure should look like this: /protected-folder/ protected-file.txt .htaccess .htpasswd /site/ /wire/ ...etc This works for protecting 'protected-file.txt' (or any file in this folder). But you cannot get the directory listing for 'protected-folder' unless you explicitly enable indexes in /protected-folder/.htaccess by adding this: Options +Indexes 2
artaylor Posted June 24, 2017 Author Posted June 24, 2017 On 19/06/2017 at 6:15 PM, Robin S said: @artaylor, I tested this and PW does not interfere with htpasswd protection of a folder in the site root. Your folder structure should look like this: /protected-folder/ protected-file.txt .htaccess .htpasswd /site/ /wire/ ...etc This works for protecting 'protected-file.txt' (or any file in this folder). But you cannot get the directory listing for 'protected-folder' unless you explicitly enable indexes in /protected-folder/.htaccess by adding this: Options +Indexes @Robin S, Thanks. I do have a separate folder from the root with it's own .htaccess file like you have here. However, it does not work unless I remove the .htaccess file in the root of the site (the PW one). I will try again.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now