Protecting files on your website from unauthorized users can be very important.

Here we will be discussing on how to password protect your development site using Apache2 Basic Authentication which makes a use of .htaccess & .htpasswd files.

1) Modify .htaccess file with the following content Add on the top. : –
AuthName “Authorisation Required”
AuthUserFile “/path/to/.htpasswd”
AuthType Basic
require valid-user
ErrorDocument 401 “Authorisation Required”

2) Create and upload the .htpasswd file to ‘AuthUserFile’ path with the following content :-
webcreta:$apr1$QTOy.YsO$ELdQeJsUiEnEPME50ErNN/
Where webcreta is the Username and $apr1$QTOy.YsO$ELdQeJsUiEnEPME50ErNN/ is the MD5 encrypted password of webcreta12345.
You can Generate Password from Following link:

Htpasswd Generator – Create htpasswd


Hope this helps you in password protecting your site.

3) Now try to visit the dev site, you will get the screen:

Password Protection in Magento

Leave a Reply