2020-04-26, 01:17:40
First of all you have to contact support of your hoster, because every hoster
has it's own way of handling password protected folders. That means that
even if you are doing everything right with a .htaccess file it still might not
work because of the hosters own way of handling protected folders.
Things to check:
1) did you create a correct hashed password that goes in the .htpasswd file ?
if you are not sure about that, use this service to create a hashed password:
https://hostingcanada.org/htpasswd-generator/
2) Note for Security:
the .htpasswd file goes inside a folder that should not be accessable by a visitor
but only by Apache. Usually put the .htpasswd file above the web root.
Usually you can access folders above the web root with your FTP,
if not, contact your hoster support and they will do it for you
3) Did you specify correctly the path to the .htpasswd file in the .htaccess file ?
the .htaccess file goes inside the folder or subdirectory you want to protect
the .htpasswd file goes inside a folder that should not be accessable by a visitor
but only by Apache. Usually put the .htpasswd file above the web root
4) Did you create a correct .htaccess file ?
here is an example:
AuthType Basic
AuthName "Your own custom authorization required message."
AuthUserFile /path/to/.htpasswd
require valid-user
has it's own way of handling password protected folders. That means that
even if you are doing everything right with a .htaccess file it still might not
work because of the hosters own way of handling protected folders.
Things to check:
1) did you create a correct hashed password that goes in the .htpasswd file ?
if you are not sure about that, use this service to create a hashed password:
https://hostingcanada.org/htpasswd-generator/
2) Note for Security:
the .htpasswd file goes inside a folder that should not be accessable by a visitor
but only by Apache. Usually put the .htpasswd file above the web root.
Usually you can access folders above the web root with your FTP,
if not, contact your hoster support and they will do it for you
3) Did you specify correctly the path to the .htpasswd file in the .htaccess file ?
the .htaccess file goes inside the folder or subdirectory you want to protect
the .htpasswd file goes inside a folder that should not be accessable by a visitor
but only by Apache. Usually put the .htpasswd file above the web root
4) Did you create a correct .htaccess file ?
here is an example:
AuthType Basic
AuthName "Your own custom authorization required message."
AuthUserFile /path/to/.htpasswd
require valid-user