I'm using something like this in .htaccess file to restrict access to the website:
AuthUserFile /some/directory/.passwd
AuthGroupFile /dev/null
AuthName EnterPassword
AuthType Basic
require valid-user
This works fine but the user is asked to authenticate each time a subdomain is changed, like user1.mywebsite.com, user2.mywebsite.com or just mywebsite.com
Is there a way to tell Apache2 that when a user is authenticated against one subdomain, it should grant him access to all others as well?