ftimme
2011-10-13 af486448586d3a97f3951d876671626381c0c6c3
- Fixed #1798.
2 files modified
28 ■■■■ changed files
server/conf/vhost.conf.master 6 ●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 22 ●●●●● patch | view | raw | blame | history
server/conf/vhost.conf.master
@@ -210,17 +210,13 @@
        Allow from all
    </Directory>
</tmpl_if>
<tmpl_if name="rewrite_enabled">
    RewriteEngine on
<tmpl_if name='seo_redirect_enabled'>
    RewriteCond %{HTTP_HOST} ^<tmpl_var name='seo_redirect_origin_domain'>$ [NC]
    RewriteRule ^(.*)$ http://<tmpl_var name='seo_redirect_target_domain'>/$1 [R=301,L]
</tmpl_if>
<tmpl_loop name="redirects">
    RewriteCond %{HTTP_HOST}   <tmpl_var name='rewrite_domain'>$ [NC]
    RewriteRule   ^/(.*)$ <tmpl_var name='rewrite_target'>$1  <tmpl_var name='rewrite_type'>
server/plugins-available/apache2_plugin.inc.php
@@ -827,12 +827,13 @@
            $tpl->setVar('alias','');
        }
        if(count($rewrite_rules) > 0) {
        if(count($rewrite_rules) > 0 || $vhost_data['seo_redirect_enabled'] > 0) {
            $tpl->setVar('rewrite_enabled',1);
        } else {
            $tpl->setVar('rewrite_enabled',0);
        }
        $tpl->setLoop('redirects',$rewrite_rules);
        //$tpl->setLoop('redirects',$rewrite_rules);
        /**
         * install fast-cgi starter script and add script aliasd config
@@ -958,21 +959,38 @@
        $vhosts = array();
        
        //* Add vhost for ipv4 IP
        if(count($rewrite_rules) > 0){
            $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80, 'redirects' => $rewrite_rules);
        } else {
        $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 0, 'port' => 80 );
        }
        
        //* Add vhost for ipv4 IP with SSL
        if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
            if(count($rewrite_rules) > 0){
                $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443', 'redirects' => $rewrite_rules);
            } else {
            $vhosts[] = array('ip_address' => $data['new']['ip_address'], 'ssl_enabled' => 1, 'port' => '443' );
            }
            $app->log('Enable SSL for: '.$domain,LOGLEVEL_DEBUG);
        }
        
        //* Add vhost for IPv6 IP
        if($data['new']['ipv6_address'] != '') {
            if(count($rewrite_rules) > 0){
                $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80, 'redirects' => $rewrite_rules);
            } else {
            $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 0, 'port' => 80 );
            }
        
            //* Add vhost for ipv6 IP with SSL
            if($data['new']['ssl_domain'] != '' && $data['new']['ssl'] == 'y' && @is_file($crt_file) && @is_file($key_file) && (@filesize($crt_file)>0)  && (@filesize($key_file)>0)) {
                if(count($rewrite_rules) > 0){
                    $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443', 'redirects' => $rewrite_rules);
                } else {
                $vhosts[] = array('ip_address' => '['.$data['new']['ipv6_address'].']', 'ssl_enabled' => 1, 'port' => '443' );
                }
                $app->log('Enable SSL for IPv6: '.$domain,LOGLEVEL_DEBUG);
            }
        }