diff --git a/interface/web/admin/lib/lang/de_system_config.lng b/interface/web/admin/lib/lang/de_system_config.lng
index 79f80c2f8bfc3eebcdf674310e58b3996b2abdfc..5eaa996fe4a1bde0c984dd6b8e2f351c7aa3ddf1 100644
--- a/interface/web/admin/lib/lang/de_system_config.lng
+++ b/interface/web/admin/lib/lang/de_system_config.lng
@@ -6,7 +6,7 @@ $wb['dbuser_prefix_txt'] = 'Datenbankbenutzer Prefix';
 $wb['shelluser_prefix_txt'] = 'Shellbenutzer Prefix';
 $wb['ftpuser_prefix_txt'] = 'FTP Benutzer Prefix';
 $wb['vhost_subdomains_txt'] = 'Subdomains als Website anlegen';
-$wb['vhost_subdomains_note_txt'] = 'Diese Einstellung kann nicht geändert werden, wenn Subdomains im System vorhanden sind!';
+$wb['vhost_subdomains_note_txt'] = 'Diese Einstellung kann nicht wieder deaktiviert werden, wenn Vhost Subdomains im System vorhanden sind!';
 $wb['dbname_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbanknamen Prefix.';
 $wb['dbuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in Datenbankbenutzer Prefix.';
 $wb['ftpuser_prefix_error_regex'] = 'Zeichen nicht erlaubt in FTP Benutzer Prefix.';
diff --git a/interface/web/admin/lib/lang/en_system_config.lng b/interface/web/admin/lib/lang/en_system_config.lng
index dc2f96e154d4fde3f471fa61843491247ec55c67..4fbaa579b23aac16d728db0ee8d076fe6c6d70f2 100644
--- a/interface/web/admin/lib/lang/en_system_config.lng
+++ b/interface/web/admin/lib/lang/en_system_config.lng
@@ -10,7 +10,7 @@ $wb["shelluser_prefix_txt"] = 'Shell user prefix';
 $wb["webdavuser_prefix_txt"] = 'Webdav user prefix';
 $wb["ftpuser_prefix_txt"] = 'FTP user prefix';
 $wb['vhost_subdomains_txt'] = 'Create Subdomains as web site';
-$wb['vhost_subdomains_note_txt'] = 'You cannot change this as long as subdomains exist in the system!';
+$wb['vhost_subdomains_note_txt'] = 'You cannot disable this as long as vhost subdomains exist in the system!';
 $wb["dbname_prefix_error_regex"] = 'Char not allowed in database name prefix.';
 $wb["dbuser_prefix_error_regex"] = 'Char not allowed in database user prefix.';
 $wb["ftpuser_prefix_error_regex"] = 'Char not allowed in ftp user prefix.';
diff --git a/interface/web/admin/system_config_edit.php b/interface/web/admin/system_config_edit.php
index c78e91917f6873975c45bf4079095150426f6a50..dc615a1f6cf0f27b993c0f80319718e932e62868 100644
--- a/interface/web/admin/system_config_edit.php
+++ b/interface/web/admin/system_config_edit.php
@@ -88,11 +88,11 @@ class page_action extends tform_actions {
         
 		$server_config_array = $app->getconf->get_global_config();
 		$new_config = $app->tform->encode($this->dataRecord,$section);
-        if($section == 'sites' && $new_config['vhost_subdomains'] != $server_config_array['vhost_subdomains']) {
-            // check for existing subdomains
-            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'subdomain' OR `type` = 'vhostsubdomain'");
+        if($section == 'sites' && $new_config['vhost_subdomains'] != 'y' && $server_config_array['vhost_subdomains'] == 'y') {
+            // check for existing vhost subdomains, if found the mode cannot be disabled
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain'");
             if($check['cnt'] > 0) {
-                $new_config['vhost_subdomains'] = $server_config_array['vhost_subdomains'];
+                $new_config['vhost_subdomains'] = 'y';
             }
         }
         $server_config_array[$section] = $new_config;
diff --git a/interface/web/sites/form/web_vhost_subdomain.tform.php b/interface/web/sites/form/web_vhost_subdomain.tform.php
index 448e3ae339ca91e381c1f6eeab59b721b0a81973..1b257671208a40f5a9f54e5d96ba234a39b606eb 100644
--- a/interface/web/sites/form/web_vhost_subdomain.tform.php
+++ b/interface/web/sites/form/web_vhost_subdomain.tform.php
@@ -277,7 +277,7 @@ $form["tabs"]['domain'] = array (
 $form["tabs"]['redirect'] = array (
 	'title' 	=> "Redirect",
 	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_redirect.htm",
+	'template' 	=> "templates/web_vhost_subdomain_redirect.htm",
 	'readonly'	=> false,
 	'fields' 	=> array (
 	##################################
@@ -317,7 +317,7 @@ if($ssl_available) {
 $form["tabs"]['ssl'] = array (
 	'title' 	=> "SSL",
 	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_ssl.htm",
+	'template' 	=> "templates/web_vhost_subdomain_ssl.htm",
 	'readonly'	=> false,
 	'fields' 	=> array (
 	##################################
@@ -453,7 +453,7 @@ $form["tabs"]['ssl'] = array (
 $form["tabs"]['stats'] = array (
 	'title' 	=> "Stats",
 	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_stats.htm",
+	'template' 	=> "templates/web_vhost_subdomain_stats.htm",
 	'readonly'	=> false,
 	'fields' 	=> array (
 	##################################
@@ -486,7 +486,7 @@ $form["tabs"]['stats'] = array (
 $form["tabs"]['backup'] = array (
 	'title' 	=> "Backup",
 	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_backup.htm",
+	'template' 	=> "templates/web_vhost_subdomain_backup.htm",
 	'readonly'	=> false,
 	'fields' 	=> array (
 	##################################
@@ -524,7 +524,7 @@ if($_SESSION["s"]["user"]["typ"] == 'admin') {
 $form["tabs"]['advanced'] = array (
 	'title' 	=> "Options",
 	'width' 	=> 100,
-	'template' 	=> "templates/web_domain_advanced.htm",
+	'template' 	=> "templates/web_vhost_subdomain_advanced.htm",
 	'readonly'	=> false,
 	'fields' 	=> array (
 	##################################
diff --git a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng
index 92f55a9811eef58d9469dd9c8323c00e9e1745c3..d4d9660e8b4e505b95aff792c69d385acf332bf6 100644
--- a/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng
+++ b/interface/web/sites/lib/lang/de_web_vhost_subdomain.lng
@@ -15,6 +15,7 @@ $wb['ssl_bundle_txt'] = 'SSL-Bundle';
 $wb['ssl_action_txt'] = 'SSL-Aktion';
 $wb['server_id_txt'] = 'Server';
 $wb['domain_txt'] = 'Domain';
+$wb["host_txt"] = 'Host';
 $wb['type_txt'] = 'Typ';
 $wb['parent_domain_id_txt'] = 'Zugehörige Website';
 $wb['web_folder_error_regex'] = 'Ungültige Ordnerangabe, bitte keinen / eingeben.';
diff --git a/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng b/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng
index 274a5b63c34a44acb8aabcdb331cb7d9551d8914..42c6e4fe536f9f204e8f2810f14fb5ad5e4739b1 100644
--- a/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng
+++ b/interface/web/sites/lib/lang/en_web_vhost_subdomain.lng
@@ -18,6 +18,7 @@ $wb["ssl_action_txt"] = 'SSL Action';
 $wb["ssl_domain_txt"] = 'SSL Domain';
 $wb["server_id_txt"] = 'Server';
 $wb["domain_txt"] = 'Domain';
+$wb["host_txt"] = 'Hostname';
 $wb['web_folder_error_regex'] = 'Invalid folder entered. Please do not enter a slash.';
 $wb["type_txt"] = 'Type';
 $wb["parent_domain_id_txt"] = 'Parent Website';
diff --git a/interface/web/sites/lib/module.conf.php b/interface/web/sites/lib/module.conf.php
index aa0cb67efa334d34a5f14359c144590b76206813..1e11450f8130df660e31c45ae01fd4ab41c31dec 100644
--- a/interface/web/sites/lib/module.conf.php
+++ b/interface/web/sites/lib/module.conf.php
@@ -21,13 +21,20 @@ $items[] = array(   'title' 	=> "Website",
 
 if($app->auth->get_client_limit($userid,'web_subdomain') != 0)
 {
+$items[] = array(   'title' 	=> "Subdomain",
+                    'target' 	=> 'content',
+                    'link'      => 'sites/web_subdomain_list.php',
+                    'html_id'   => 'subdomain_list');
+
     // read web config
     $app->uses('getconf');
     $sys_config = $app->getconf->get_global_config('sites');
-$items[] = array(   'title' 	=> "Subdomain",
+    if($sys_config['vhost_subdomains'] == 'y') {
+$items[] = array(   'title' 	=> "Subdomain (Vhost)",
                     'target' 	=> 'content',
-                    'link'      => 'sites/' . ($sys_config['vhost_subdomains'] == 'y' ? 'web_vhost_subdomain_list.php' : 'web_subdomain_list.php'),
+                    'link'      => 'sites/web_vhost_subdomain_list.php',
                     'html_id'   => 'subdomain_list');
+    }
 }
 
 if($app->auth->get_client_limit($userid,'web_aliasdomain') != 0)
diff --git a/interface/web/sites/templates/web_vhost_subdomain_advanced.htm b/interface/web/sites/templates/web_vhost_subdomain_advanced.htm
new file mode 100644
index 0000000000000000000000000000000000000000..87107400af24704f79644aa7ac3cc83dac2373cf
--- /dev/null
+++ b/interface/web/sites/templates/web_vhost_subdomain_advanced.htm
@@ -0,0 +1,146 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_web_domain">
+
+    <div class="pnl_formsarea">
+        <fieldset class="inlineLabels">
+            <input name="document_root" id="document_root" value="{tmpl_var name='document_root'}" size="30" maxlength="255" type="hidden" class="textInput" />
+            <div class="ctrlHolder">
+                <label for="system_user">{tmpl_var name='system_user_txt'}</label>
+                <label for="system_user">{tmpl_var name='system_user'}</label>
+                <input name="system_user" id="system_user" value="{tmpl_var name='system_user'}" type="hidden" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="system_group">{tmpl_var name='system_group_txt'}</label>
+                <label for="system_group">{tmpl_var name='system_group'}</label>
+                <input name="system_group" id="system_group" value="{tmpl_var name='system_group'}" type="hidden" />
+            </div>
+            <div class="ctrlHolder apache">
+                <label for="allow_override">{tmpl_var name='allow_override_txt'}</label>
+                <input name="allow_override" id="allow_override" value="{tmpl_var name='allow_override'}" size="30" maxlength="255" type="text" class="textInput" />
+            </div>
+            <div class="phpfpm">
+                <div class="ctrlHolder">
+                    <p class="label">{tmpl_var name='php_fpm_use_socket_txt'}</p>
+                    <div class="multiField">
+                        {tmpl_var name='php_fpm_use_socket'}
+                    </div>
+                </div>
+                <div class="ctrlHolder">
+                    <label for="pm">{tmpl_var name='pm_txt'}</label>
+                    <select name="pm" id="pm" class="selectInput">
+                        {tmpl_var name='pm'}
+                    </select>
+                </div>
+                <div class="ctrlHolder pm_ondemand" style="background: #ffdfdf; border: 1px solid #df7d7d; border-width: 1px 0; margin: 1.5em 0 1.5em 0; padding: 7px;">
+                    {tmpl_var name='pm_ondemand_hint_txt'}
+                </div>
+                <div class="ctrlHolder">
+                    <label for="pm_max_children">{tmpl_var name='pm_max_children_txt'}</label>
+                    <input name="pm_max_children" id="pm_max_children" value="{tmpl_var name='pm_max_children'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" />
+                </div>
+                <div class="ctrlHolder pm_dynamic">
+                    <label for="pm_start_servers">{tmpl_var name='pm_start_servers_txt'}</label>
+                    <input name="pm_start_servers" id="pm_start_servers" value="{tmpl_var name='pm_start_servers'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" />
+                </div>
+                <div class="ctrlHolder pm_dynamic">
+                    <label for="pm_min_spare_servers">{tmpl_var name='pm_min_spare_servers_txt'}</label>
+                    <input name="pm_min_spare_servers" id="pm_min_spare_servers" value="{tmpl_var name='pm_min_spare_servers'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" />
+                </div>
+                <div class="ctrlHolder pm_dynamic">
+                    <label for="pm_max_spare_servers">{tmpl_var name='pm_max_spare_servers_txt'}</label>
+                    <input name="pm_max_spare_servers" id="pm_max_spare_servers" value="{tmpl_var name='pm_max_spare_servers'}" size="3" maxlength="3" type="text" class="textInput formLengthLimit" />
+                </div>
+                <div class="ctrlHolder pm_ondemand">
+                    <label for="pm_process_idle_timeout">{tmpl_var name='pm_process_idle_timeout_txt'}</label>
+                    <input name="pm_process_idle_timeout" id="pm_process_idle_timeout" value="{tmpl_var name='pm_process_idle_timeout'}" size="3" maxlength="6" type="text" class="textInput formLengthLimit" />&nbsp;s
+                </div>
+                <div class="ctrlHolder">
+                    <label for="pm_max_requests">{tmpl_var name='pm_max_requests_txt'}</label>
+                    <input name="pm_max_requests" id="pm_max_requests" value="{tmpl_var name='pm_max_requests'}" size="3" maxlength="6" type="text" class="textInput formLengthLimit" />
+                </div>
+            </div>
+            <div class="ctrlHolder">
+                <label for="php_open_basedir">{tmpl_var name='php_open_basedir_txt'}</label>
+                <input name="php_open_basedir" id="php_open_basedir" value="{tmpl_var name='php_open_basedir'}" size="30" type="text" class="textInput"  style="width:400px;" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="custom_php_ini">{tmpl_var name='custom_php_ini_txt'}</label>
+                <textarea name="custom_php_ini" id="custom_php_ini" rows='10' cols='50' style="width:400px;">{tmpl_var name='custom_php_ini'}</textarea>
+            </div>
+            <div class="ctrlHolder apache">
+                <label for="apache_directives">{tmpl_var name='apache_directives_txt'}</label>
+                <textarea name="apache_directives" id="apache_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='apache_directives'}</textarea>
+            </div>
+            <div class="ctrlHolder nginx">
+                <label for="nginx_directives">{tmpl_var name='nginx_directives_txt'}</label>
+                <textarea name="nginx_directives" id="nginx_directives" rows='10' cols='50' style="width:400px;">{tmpl_var name='nginx_directives'}</textarea>
+            </div>
+        </fieldset>
+
+        <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+        <div class="buttonHolder buttons">
+            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+        </div>
+    </div>
+
+</div>
+<script language="JavaScript" type="text/javascript">
+    var webId = jQuery('input[name="id"]').val();
+    var serverId;
+    getServerId();
+    adjustForm();
+		
+    var pm = jQuery('#pm').val();
+    pmMode(pm);
+    jQuery('#pm').change(function(){
+        pm = jQuery(this).val();
+        pmMode(pm);
+    });
+		
+    function pmMode(pm){
+        switch(pm){
+            case "static":
+                jQuery('.pm_dynamic').add('.pm_ondemand').hide();
+                jQuery('.pm_static').show();
+                break;
+            case "dynamic":
+                jQuery('.pm_static').add('.pm_ondemand').hide();
+                jQuery('.pm_dynamic').show();
+                break;
+            case "ondemand":
+                jQuery('.pm_static').add('.pm_dynamic').hide();
+                jQuery('.pm_ondemand').show();
+                break;
+        }
+    }
+		
+    function getServerId(){
+        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getserverid"}, function(data) {
+            serverId = data.serverid;
+        });
+    }
+		
+    function adjustForm(){
+        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
+            if(data.servertype == "nginx"){
+                jQuery('.nginx').show();
+                jQuery('.apache').hide();
+            } else {
+                jQuery('.nginx').hide();
+                jQuery('.apache').show();
+            }
+        });
+        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getphptype"}, function(data) {
+            if(data.phptype == "php-fpm"){
+                jQuery('.phpfpm').show();
+            } else {
+                jQuery('.phpfpm').hide();
+            }
+        });
+    }
+			
+</script>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_vhost_subdomain_backup.htm b/interface/web/sites/templates/web_vhost_subdomain_backup.htm
new file mode 100644
index 0000000000000000000000000000000000000000..c46d4e2d4ef9a3fd0aae5921d68d194f959bfb86
--- /dev/null
+++ b/interface/web/sites/templates/web_vhost_subdomain_backup.htm
@@ -0,0 +1,32 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_web_domain">
+
+    <div class="pnl_formsarea">
+        <fieldset class="inlineLabels"><legend>Backup</legend>
+            <div class="ctrlHolder">
+                <label for="backup_interval">{tmpl_var name='backup_interval_txt'}</label>
+                <select name="backup_interval" id="backup_interval" class="selectInput">
+                    {tmpl_var name='backup_interval'}
+                </select>
+            </div>
+            <div class="ctrlHolder">
+                <label for="backup_copies">{tmpl_var name='backup_copies_txt'}</label>
+                <select name="backup_copies" id="backup_copies" class="selectInput">
+                    {tmpl_var name='backup_copies'}
+                </select>
+            </div>
+        </fieldset>
+
+        {tmpl_var name='backup_records'}
+
+        <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+        <div class="buttonHolder buttons">
+            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+        </div>
+    </div>
+
+</div>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_vhost_subdomain_redirect.htm b/interface/web/sites/templates/web_vhost_subdomain_redirect.htm
new file mode 100644
index 0000000000000000000000000000000000000000..66a17034c9b27fec864671d69ddddf1024273511
--- /dev/null
+++ b/interface/web/sites/templates/web_vhost_subdomain_redirect.htm
@@ -0,0 +1,76 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_web_domain">
+
+    <div class="pnl_formsarea">
+        <fieldset class="inlineLabels">
+            <div class="ctrlHolder">
+                <label for="redirect_type">{tmpl_var name='redirect_type_txt'}</label>
+                <select name="redirect_type" id="redirect_type" class="selectInput formLengthHalf">
+                    {tmpl_var name='redirect_type'}
+                </select>
+            </div>
+            <div class="ctrlHolder">
+                <label for="redirect_path">{tmpl_var name='redirect_path_txt'}</label>
+                <input name="redirect_path" id="redirect_path" value="{tmpl_var name='redirect_path'}" size="30" maxlength="255" type="text" class="textInput" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="seo_redirect">{tmpl_var name='seo_redirect_txt'}</label>
+                <select name="seo_redirect" id="seo_redirect" class="selectInput formLengthHalf">
+                    {tmpl_var name='seo_redirect'}
+                </select>
+            </div>
+        </fieldset>
+
+        <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+        <div class="buttonHolder buttons">
+            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+        </div>
+    </div>
+
+</div>
+<script language="JavaScript" type="text/javascript">
+    var webId = jQuery('input[name="id"]').val();
+    var serverId;
+    getServerId(webId);
+		
+    function getServerId(webId){
+        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {web_id : webId, type : "getserverid"}, function(data) {
+            serverId = data.serverid;
+            adjustForm(serverId);
+        });
+    }
+		
+    function adjustForm(serverId){
+        jQuery.getJSON('sites/ajax_get_json.php'+ '?' + Math.round(new Date().getTime()), {server_id : serverId, type : "getservertype"}, function(data) {
+            var selected = jQuery('#redirect_type').val();
+            if(data.servertype == "nginx"){
+                jQuery("#redirect_type option[value='R']").attr('disabled','disabled');
+                jQuery('#redirect_type option[value="L"]').attr('disabled','disabled');
+                jQuery('#redirect_type option[value="R,L"]').attr('disabled','disabled');
+                jQuery('#redirect_type option[value="R=301,L"]').attr('disabled','disabled');
+
+                jQuery('#redirect_type option[value="R"]').hide();
+                jQuery('#redirect_type option[value="L"]').hide();
+                jQuery('#redirect_type option[value="R,L"]').hide();
+                jQuery('#redirect_type option[value="R=301,L"]').hide();
+                if(selected != "no" && selected != "" && selected != "last"  && selected != "break"  && selected != "redirect"  && selected != "permanent") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+            } else {
+                jQuery('#redirect_type option[value="last"]').attr('disabled','disabled');
+                jQuery('#redirect_type option[value="break"]').attr('disabled','disabled');
+                jQuery('#redirect_type option[value="redirect"]').attr('disabled','disabled');
+                jQuery('#redirect_type option[value="permanent"]').attr('disabled','disabled');
+					
+                jQuery('#redirect_type option[value="last"]').hide();
+                jQuery('#redirect_type option[value="break"]').hide();
+                jQuery('#redirect_type option[value="redirect"]').hide();
+                jQuery('#redirect_type option[value="permanent"]').hide();
+                if(selected != "no" && selected != "" && selected != "R"  && selected != "L"  && selected != "R,L" && selected != "R=301,L") jQuery('#redirect_type option[value="no"]').attr('selected', 'selected');
+            }
+        });
+    }
+			
+</script>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_vhost_subdomain_ssl.htm b/interface/web/sites/templates/web_vhost_subdomain_ssl.htm
new file mode 100644
index 0000000000000000000000000000000000000000..4c27bb77298df546759290df5dfd967d1400d8e7
--- /dev/null
+++ b/interface/web/sites/templates/web_vhost_subdomain_ssl.htm
@@ -0,0 +1,68 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_web_domain">
+
+    <div class="pnl_formsarea">
+        <fieldset class="inlineLabels">
+            <div class="ctrlHolder">
+                <label for="ssl_state">{tmpl_var name='ssl_state_txt'}</label>
+                <input name="ssl_state" id="ssl_state" value="{tmpl_var name='ssl_state'}" size="30" maxlength="255" type="text" class="textInput" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_locality">{tmpl_var name='ssl_locality_txt'}</label>
+                <input name="ssl_locality" id="ssl_locality" value="{tmpl_var name='ssl_locality'}" size="30" maxlength="255" type="text" class="textInput" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_organisation">{tmpl_var name='ssl_organisation_txt'}</label>
+                <input name="ssl_organisation" id="ssl_organisation" value="{tmpl_var name='ssl_organisation'}" size="30" maxlength="255" type="text" class="textInput" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_organisation_unit">{tmpl_var name='ssl_organisation_unit_txt'}</label>
+                <input name="ssl_organisation_unit" id="ssl_organisation_unit" value="{tmpl_var name='ssl_organisation_unit'}" size="30" maxlength="255" type="text" class="textInput" />
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_country">{tmpl_var name='ssl_country_txt'}</label>
+                <select name="ssl_country" id="ssl_country" class="selectInput flags">
+                    {tmpl_var name='ssl_country'}
+                </select>
+            </div>
+            <div class="ctrlHolder">
+                <label for="client_group_id">{tmpl_var name='ssl_domain_txt'}</label>
+                <select name="ssl_domain" id="ssl_domain" class="selectInput">
+                    {tmpl_var name='ssl_domain'}
+                </select>
+            </div>
+			<div class="ctrlHolder">
+                <label for="ssl_request">{tmpl_var name='ssl_key_txt'}</label>
+                <textarea name="ssl_key" id="ssl_key" rows='10' cols='30'>{tmpl_var name='ssl_key'}</textarea>
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_request">{tmpl_var name='ssl_request_txt'}</label>
+                <textarea name="ssl_request" id="ssl_request" rows='10' cols='30'>{tmpl_var name='ssl_request'}</textarea>
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_cert">{tmpl_var name='ssl_cert_txt'}</label>
+                <textarea name="ssl_cert" id="ssl_cert" rows='10' cols='30'>{tmpl_var name='ssl_cert'}</textarea>
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_bundle">{tmpl_var name='ssl_bundle_txt'}</label>
+                <textarea name="ssl_bundle" id="ssl_bundle" rows='10' cols='30'>{tmpl_var name='ssl_bundle'}</textarea>
+            </div>
+            <div class="ctrlHolder">
+                <label for="ssl_action">{tmpl_var name='ssl_action_txt'}</label>
+                <select name="ssl_action" id="ssl_action" class="selectInput formLengthHalf">
+                    {tmpl_var name='ssl_action'}
+                </select>
+            </div>
+        </fieldset>
+
+        <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+        <div class="buttonHolder buttons">
+            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+        </div>
+    </div>
+
+</div>
\ No newline at end of file
diff --git a/interface/web/sites/templates/web_vhost_subdomain_stats.htm b/interface/web/sites/templates/web_vhost_subdomain_stats.htm
new file mode 100644
index 0000000000000000000000000000000000000000..26eee94772c6b8ea574a65495cf7fa43aad68377
--- /dev/null
+++ b/interface/web/sites/templates/web_vhost_subdomain_stats.htm
@@ -0,0 +1,37 @@
+<h2><tmpl_var name="list_head_txt"></h2>
+<p><tmpl_var name="list_desc_txt"></p>
+
+<div class="panel panel_web_domain">
+
+    <div class="pnl_formsarea">
+        <fieldset class="inlineLabels">
+            <div class="ctrlHolder">
+                <p class="label">{tmpl_var name='stats_user_txt'}</p><p class="value">admin</p>
+            </div>
+            <div class="ctrlHolder">
+                <label for="stats_password">{tmpl_var name='stats_password_txt'}</label>
+                <input name="stats_password" id="stats_password" value="{tmpl_var name='stats_password'}" size="15" maxlength="100" type="password" class="textInput" style="width:100px;" onkeyup="checkPassMatch('stats_password','repeat_password');" />&nbsp;<a href="javascript:void(0);" onClick="generatePassword('stats_password','repeat_password');">{tmpl_var name='generate_password_txt'}</a>
+            </div>
+            <div class="ctrlHolder">
+                <label for="repeat_password">{tmpl_var name='repeat_password_txt'}</label>
+                <input name="repeat_password" id="repeat_password" value="" size="15" maxlength="100" type="password" class="textInput" style="width:100px;"  onkeyup="checkPassMatch('stats_password','repeat_password');" />
+            </div>
+            <div id="confirmpasswordError" style="display:none;" class="confirmpassworderror">{tmpl_var name='password_mismatch_txt'}</div>
+            <div id="confirmpasswordOK" style="display:none;" class="confirmpasswordok">{tmpl_var name='password_match_txt'}</div>
+            <div class="ctrlHolder">
+                <label for="stats_type">{tmpl_var name='stats_type_txt'}</label>
+                <select name="stats_type" id="stats_type" class="selectInput" >
+                    {tmpl_var name='stats_type'}
+                </select>
+            </div>
+        </fieldset>
+
+        <input type="hidden" name="id" value="{tmpl_var name='id'}">
+
+        <div class="buttonHolder buttons">
+            <button class="positive iconstxt icoPositive" type="button" value="{tmpl_var name='btn_save_txt'}" onClick="submitForm('pageForm','sites/web_domain_edit.php');"><span>{tmpl_var name='btn_save_txt'}</span></button>
+            <button class="negative iconstxt icoNegative" type="button" value="{tmpl_var name='btn_cancel_txt'}" onClick="loadContent('sites/web_domain_list.php');"><span>{tmpl_var name='btn_cancel_txt'}</span></button>
+        </div>
+    </div>
+
+</div>
diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php
index f972b0db1956a545f427f24e14656b839947e591..97d7d57301d48ce103d119844045c8415e7dc5ce 100644
--- a/interface/web/sites/web_domain_edit.php
+++ b/interface/web/sites/web_domain_edit.php
@@ -342,7 +342,7 @@ class page_action extends tform_actions {
 			}
 			$app->tpl->setVar("client_group_id",$client_select);
             
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, 'y');
+            foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
 		}
 
 		$ssl_domain_select = '';
diff --git a/interface/web/sites/web_vhost_subdomain_edit.php b/interface/web/sites/web_vhost_subdomain_edit.php
index a5866c879821c08cca7f443df7bda716f1ece196..e71841359495607e5d592147ff7ee440d2c7b6e1 100644
--- a/interface/web/sites/web_vhost_subdomain_edit.php
+++ b/interface/web/sites/web_vhost_subdomain_edit.php
@@ -196,7 +196,7 @@ class page_action extends tform_actions {
 			$app->tpl->setVar("fastcgi_php_version",$php_select);
 			unset($php_records);
 
-            foreach($read_limits as $limit) $app->tpl->setVar($limit, 'y');
+            foreach($read_limits as $limit) $app->tpl->setVar($limit, ($limit == 'force_suexec' ? 'n' : 'y'));
 		}
 
 		$ssl_domain_select = '';
@@ -245,17 +245,20 @@ class page_action extends tform_actions {
 		$this->parent_domain_record = $parent_domain;
         
         $read_limits = array('limit_cgi', 'limit_ssi', 'limit_perl', 'limit_ruby', 'limit_python', 'force_suexec', 'limit_hterror', 'limit_wildcard', 'limit_ssl');
-        $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
-        $forbidden_folders = array('', 'cgi-bin', 'web', 'log', 'private', 'ssl', 'tmp', 'webdav');
-        if(in_array($this->dataRecord['web_folder'], $forbidden_folders) || preg_match('/^log_web\d+$/', $this->dataRecord['web_folder'])) {
-            $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>";
-        }
-        // check for duplicate folder usage
-        $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "'");
-        if($check && $check['cnt'] > 0) {
-            $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."<br>";
+        
+        if($app->tform->getCurrentTab() == 'domain') {
+            $this->dataRecord['web_folder'] = strtolower($this->dataRecord['web_folder']);
+            $forbidden_folders = array('', 'cgi-bin', 'web', 'log', 'private', 'ssl', 'tmp', 'webdav');
+            if(in_array($this->dataRecord['web_folder'], $forbidden_folders)) {
+                $app->tform->errorMessage .= $app->tform->lng("web_folder_invalid_txt")."<br>";
+            }
+            // check for duplicate folder usage
+            $check = $app->db->queryOneRecord("SELECT COUNT(*) as `cnt` FROM `web_domain` WHERE `type` = 'vhostsubdomain' AND `parent_domain_id` = '" . intval($this->dataRecord['parent_domain_id']) . "' AND `web_folder` = '" . $app->db->quote($this->dataRecord['web_folder']) . "' AND `domain_id` != '" . intval($this->id) . "'");
+            if($check && $check['cnt'] > 0) {
+                $app->tform->errorMessage .= $app->tform->lng("web_folder_unique_txt")."<br>";
+            }
         }
-
+        
 		if($_SESSION["s"]["user"]["typ"] != 'admin') {
 			// Get the limits of the client
 			$client_group_id = $_SESSION["s"]["user"]["default_group"];
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index a861265a922488d8e101e80deff51fc6964c5890..bd1b1c10f04047e3dbbd7f9f8ed5c59338573a42 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -328,8 +328,12 @@ class apache2_plugin {
         $web_folder = 'web';
         $log_folder = 'log';
         if($data['new']['type'] == 'vhostsubdomain') {
+            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
             $web_folder = $data['new']['web_folder'];
-            $log_folder .= '_web' . $data['new']['domain_id'];
+            $log_folder .= '/' . $subdomain_host;
+            unset($tmp);
         }
 
 		// Create group and user, if not exist
@@ -471,7 +475,7 @@ class apache2_plugin {
         if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
-			$app->system->mkdir($data['new']['document_root'].'/'.$log_folder);
+			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
 			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
 			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 424d96fa8e9427d46c3f7c60dc871f14927055f2..255fca43b0adca7a9969f3a178f543a40fa5b139 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -322,8 +322,12 @@ class nginx_plugin {
         $web_folder = 'web';
         $log_folder = 'log';
         if($data['new']['type'] == 'vhostsubdomain') {
+            $tmp = $app->db->queryOneRecord('SELECT `domain` FROM web_domain WHERE domain_id = '.intval($data['new']['parent_domain_id']));
+            $subdomain_host = preg_replace('/^(.*)\.' . preg_quote($tmp['domain'], '/') . '$/', '$1', $data['new']['domain']);
+            if($subdomain_host == '') $subdomain_host = 'web'.$data['new']['domain_id'];
             $web_folder = $data['new']['web_folder'];
-            $log_folder .= '_web' . $data['new']['domain_id'];
+            $log_folder .= '/' . $subdomain_host;
+            unset($tmp);
         }
 
 		// Create group and user, if not exist
@@ -459,7 +463,7 @@ class nginx_plugin {
         if(!is_dir('/var/log/ispconfig/httpd/'.$data['new']['domain'])) exec('mkdir -p /var/log/ispconfig/httpd/'.$data['new']['domain']);
 		if(!is_dir($data['new']['document_root'].'/'.$log_folder) || is_link($data['new']['document_root'].'/'.$log_folder)) {
 			if(is_link($data['new']['document_root'].'/'.$log_folder)) unlink($data['new']['document_root'].'/'.$log_folder);
-			$app->system->mkdir($data['new']['document_root'].'/'.$log_folder);
+			$app->system->mkdirpath($data['new']['document_root'].'/'.$log_folder);
 			$app->system->chown($data['new']['document_root'].'/'.$log_folder,'root');
 			$app->system->chgrp($data['new']['document_root'].'/'.$log_folder,'root');
 			$app->system->chmod($data['new']['document_root'].'/'.$log_folder,0755);