Q:

htaccess on same server with multiple URLs

Is it possible to have .htaccess prompt only once for multiple URLs on my server?
Basically, I have a web server directory:
/var/www/html/MainSite/.htaccess
Which is browseable via http://main.myowndomain.com/
then I have sub directorties
/var/www/html/MainSite/SubSite1/index.html
/var/www/html/MainSite/SubSite2/index.html
/var/www/html/MainSite/SubSite3/index.html
My network interface has the following eth.x set up
eth0......inet address 1.1.1.1
eth0:1....inet address 1.1.1.2
eth0:2....inet address 1.1.1.3
eth0:3....inet address 1.1.1.4
My httpd.conf file has
<VirtualHost 1.1.1.2:80>
    ServerAdmin admin@myowndomain.com
    DocumentRoot /var/www/html/MainSite1
    ServerName subsite1.myowndomain.com
</VirtualHost>

<VirtualHost 1.1.1.3:80>
    ServerAdmin admin@myowndomain.com
    DocumentRoot /var/www/html/MainSite/SubSite2
    ServerName subsite2.myowndomain.com
</VirtualHost>

<VirtualHost 1.1.1.4:80>
    ServerAdmin admin@myowndomain.com
    DocumentRoot /var/www/html/MainSite/SubSite3
    ServerName subsite3.myowndomain.com
</VirtualHost>

My .htaccess is basic authentication
<Files ~ "^\.(htaccess|htpasswd)$">
    deny from all
</Files>
Options Indexes
AuthUserFile /var/www/.htpasswd
#AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user

If I browse to subsite1.myowndomain.com it prompts me for authentication, then if I click on a link, it prompts me again for main.myowndomain.com.
Is there a way for it to transfer over since its the same server or since its a virtual host, I have to enter for each site name?

A:

I was able to achieve the results I wanted by adding a redirect in each Virtual Host section.
<VirtualHost 1.1.1.1:80>
    ServerAdmin admin@myowndomain.com
    DocumentRoot /var/www/html/MainSite/Subsite1
    ServerName main.myowndomain.com
    Redirect 301 / http://mainsite.myowndomain.com/MainSite/Subsite1
</VirtualHost>

<VirtualHost 1.1.1.2:80>
    ServerAdmin admin@myowndomain.com
    DocumentRoot /var/www/html/MainSite/SubSite2
    ServerName subsite1.myowndomain.com
    Redirect 301 / http://mainsite.myowndomain.com/MainSite/Subsite2
</VirtualHost>

<VirtualHost 1.1.1.3:80>
    ServerAdmin admin@myowndomain.com
    DocumentRoot /var/www/html/MainSite/SubSite3
    ServerName subsite2.myowndomain.com
    Redirect 301 / http://mainsite.myowndomain.com/MainSite/Subsite3
</VirtualHost>

Now when I go to subsite2.myowndomain.com, I get prompted for credentials and no longer get prompted for the other URLs.

