Apache: Using same Directory directive for multiple virtual hosts

Solution 1:

Pull your Directory stanzas outside of your VirtualHost containers and it should do what you want.

<VirtualHost *:80>
  ServerName domain.com
  ErrorLog logs/domain.com-error_log
  CustomLog logs/domain.com-access_log common
  DocumentRoot "/var/www/srs/web"
  DirectoryIndex index.php
  Alias /sf /usr/share/pear/data/symfony/web/sf
</VirtualHost>

<VirtualHost *:80>
  ServerName domain2.com
  ErrorLog logs/domain2.com-error_log
  CustomLog logs/domain2.com-access_log common
  DocumentRoot "/var/www/srs/web"
  DirectoryIndex index.php
  Alias /sf /usr/share/pear/data/symfony/web/sf
</VirtualHost>

<Directory "/usr/share/pear/data/symfony/web/sf">
  AllowOverride All
  Allow from All
</Directory>
<Directory "/var/www/srs/web">
  AllowOverride All
  Allow from All
</Directory>