What I want to achieve
I have public and private sites on my webserver, and I would like to somehow separate them, but I want this separation to be invisible.
So for example DocumentRoot is /var/www public projects are under /var/www/public, private projects are under /var/www/private.
If domain is www.example.com and I want to reach public/publicproj1 the URL would be www.example.com/publicproj1. Also if I want private/privateproj1 the URL would be www.example.com/privateproj1.
I want to restrict /var/www/private only to local network, but public should be accessible from anywhere.
Ther are a ton of projects under private, I don't want to make new settings in apache.conf every time I put something there.
Also I want /var/www/public/startingpage to be served if nothing else is requested, so www.example.com would show this page.
What I tried so far:
1.) made DocumentRoot to /var/www put public projects under it and a Rewrite Rule to the private folder like this:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ private/$1 [QSA]
This doesn't work, because there are more .htaccess files on the folders under private folder. (for example applications with front controller, forums, etc. which need their own .htaccess)
2.) made DocumentRoot to /var/www/private, but then public projects doesn't get served. (Can I make two Document roots with different Access options ?)
I made entries like Alias /publicproj1 /var/www/publicproj1 but I have Redmine installed with this settings:
RewriteEngine On
RewriteRule ^/$ /redmine [R]
<Directory /home/www/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>
which I can't replace with a simple Alias entry (or can I ?)
My questions
What folder structure should I create ? What redirect rules should I make ? How can I set /var/www/startingpage to show up when nothing else is requested ?