vhost.tpl.php 2.83 KB
Newer Older
1
<VirtualHost *:<?php print $http_port; ?>>
2 3
<?php if ($this->site_mail) : ?>
  ServerAdmin <?php  print $this->site_mail; ?> 
4
<?php endif;?>
5

6
  DocumentRoot <?php print $this->root; ?> 
7
    
8
  ServerName <?php print $this->uri; ?>
9 10 11 12 13 14 15 16 17 18 19

  SetEnv db_type  <?php print urlencode($db_type); ?>

  SetEnv db_name  <?php print urlencode($db_name); ?>

  SetEnv db_user  <?php print urlencode($db_user); ?>

  SetEnv db_passwd  <?php print urlencode($db_passwd); ?>

  SetEnv db_host  <?php print urlencode($db_host); ?>

20 21
  SetEnv db_port  <?php print urlencode($db_port); ?>

22

23 24 25
<?php 
if (sizeof($this->aliases)) {
  print "\n ServerAlias " . implode("\n ServerAlias ", $this->aliases) . "\n";
26
}
27 28 29 30 31
?>

<IfModule mod_rewrite.c>
  RewriteEngine on
<?php
32
if ($this->redirection || $ssl_redirection) {
33

34 35
  if ($ssl_redirection && !$this->redirection) {
    // redirect aliases in non-ssl to the same alias on ssl.
36
    print " RewriteRule ^/*(.*)$ https://%{HTTP_HOST}/$1 [NE,L,R=301]\n";
37
  }
38
  elseif ($ssl_redirection && $this->redirection) {
39
    // redirect all aliases + main uri to the main https uri.
40
    print " RewriteRule ^/*(.*)$ https://{$this->uri}/$1 [NE,L,R=301]\n";
41
  }
42
  elseif (!$ssl_redirection && $this->redirection) {
43
    // Redirect all aliases to the main http url.
44 45
    print " RewriteCond %{HTTP_HOST} !^{$this->uri}$ [NC]\n";
    print " RewriteRule ^/*(.*)$ http://{$this->uri}/$1 [NE,L,R=301]\n";
46 47 48
  }
}
?>
49 50 51 52
  RewriteRule ^/files/(.*)$ /sites/<?php print $this->uri; ?>/files/$1 [L]
  RewriteCond <?php print $this->site_path; ?>/files/robots.txt -f
  RewriteRule ^/robots.txt /sites/<?php print $this->uri; ?>/files/robots.txt [L]
</IfModule>
53 54 55 56

<?php print $extra_config; ?>

    # Error handler for Drupal > 4.6.7
57
    <Directory "<?php print $this->site_path; ?>/files">
58 59 60 61 62 63 64 65 66 67
      <Files *>
        SetHandler This_is_a_Drupal_security_line_do_not_remove
      </Files>
      Options None
      Options +FollowSymLinks

      # If we know how to do it safely, disable the PHP engine entirely.
      <IfModule mod_php5.c>
        php_flag engine off
      </IfModule>
68 69
    </Directory>

70 71 72
    # Prevent direct reading of files in the private dir.
    # This is for Drupal7 compatibility, which would normally drop
    # a .htaccess in those directories, but we explicitly ignore those
73
    <Directory "<?php print $this->site_path; ?>/private/" >
74 75 76 77 78 79 80 81 82 83 84
      <Files *>
        SetHandler This_is_a_Drupal_security_line_do_not_remove
      </Files>
      Deny from all
      Options None
      Options +FollowSymLinks

      # If we know how to do it safely, disable the PHP engine entirely.
      <IfModule mod_php5.c>
        php_flag engine off
      </IfModule>
85
    </Directory>
86
    
87 88 89 90 91 92
<?php
$if_subsite = $this->data['http_subdird_path'] . '/' . $this->uri;
if (subdirs_drush_load() && provision_file()->exists($if_subsite)->status()) {
  print "  Include " . $if_subsite . "/*.conf\n";
}
?>
93

94 95
</VirtualHost>