Home Linux ServerWare Apache
apache2.conf or sites-enabled must have 

AllowOverride All


Protect with .htaccess file

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
require valid-user


generate user passwd with:

htpasswd -m /var/www/.htpasswd  <username>


protect with ldap: (enable mods)
example with active directory server

AuthBasicProvider ldap
AuthType Basic
AuthzLDAPAuthoritative off
AuthName "Access with ldap"
AuthLDAPURL ldap://my.ldapserver.ca:389/OU=MyCie,DC=dev,DC=MyCie,DC=ca?sAMAccountName?sub?(objectClass=*)
AuthLDAPBindDN cn=ldapreader,cn=Users,dc=dev,dc=MyCie,dc=ca
AuthLDAPBindPassword "<passwd>"
Require ldap-group CN=SVN Access,OU=Development,OU=MyCie,DC=dev,DC=MyCie,DC=ca
Require ldap-user <ldapuser>



Redirect with htaccess:

RedirectPermanent / http://myserver.domain.com:8080/myfolder/