I would like to use a .htaccess
file to protect my symfony2 website while developing it.
I added the following line at the beginning of my .htaccess
located in /web
and a .htpasswd
file just next with my password.
AuthName "Développement"
AuthType Basic
AuthUserFile ".htpasswd"
Require valid-user
I have a Error 500 when I try to access my website. Is it possible to use a htaccess in my case ? What should I use if it is not posible ?
Assuming the 500 error is caused by these directives, the most likely reason is the path to
.htpasswd
.AuthUserFile
saysSo either use an absolute path (e.g.
/var/www/.htpasswd
) or add the complete path starting from your document root (e.g.web/.htpasswd
).Also note the last section in
AuthUserFile
This means, store the auth file somewhere else, like
/etc/apache2/htpasswd
.