.htaccess is not working in apache2 :
If you have put .htaccess in your web project directory and it does not ask for username & password.
Follow this.
1) Check following directives in /etc/apache2/sites-available/default
Where /var/www is path of the directory where you keep your web projects.<Directory /var/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory>
2) Add following directive in httpd.conf
<Directory /your/path/of/the/project> AllowOverride All </Directory>
3) Restart apache2.