diff --git a/interface/web/admin/directive_snippets_edit.php b/interface/web/admin/directive_snippets_edit.php
index e22a7cf42a2d7903121f6c87873c19a06f93a71f..3f183844bcaa7e32b8a24df2b8e5e6663d33787a 100644
--- a/interface/web/admin/directive_snippets_edit.php
+++ b/interface/web/admin/directive_snippets_edit.php
@@ -51,7 +51,7 @@ class page_action extends tform_actions {
 
 	function onShow() {
 		global $app, $conf;
-		
+
 		if($this->id > 0){
 			$record = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ?", $this->id);
 			if($record['master_directive_snippets_id'] > 0){
@@ -59,13 +59,13 @@ class page_action extends tform_actions {
 			}
 			unset($record);
 		}
-		
+
 		parent::onShow();
 	}
-	
+
 	function onShowEnd() {
-		global $app, $conf;
-		
+		global $app;
+
 		$is_master = false;
 		if($this->id > 0){
 			if($this->dataRecord['master_directive_snippets_id'] > 0){
@@ -77,53 +77,52 @@ class page_action extends tform_actions {
 		}
 
 		$app->tpl->setVar("is_master", $is_master);
-		
+
 		parent::onShowEnd();
 	}
-	
-	function onSubmit() {
+
+	public function onAfterUpdate() {
 		global $app, $conf;
 
+		if(isset($this->dataRecord['update_sites']) && $this->dataRecord['update_sites'] === 'y') {
+			if($this->dataRecord['active'] == 'y' && $this->dataRecord['update_sites'] == 'y') {
+				if($this->dataRecord['type'] == 'php') {
+					$rlike = $this->dataRecord['directive_snippets_id'].'|,'.$this->dataRecord['directive_snippets_id'].'|'.$this->dataRecord['directive_snippets_id'].',';
+					$affected_snippets = $app->db->queryAllRecords('SELECT directive_snippets_id FROM directive_snippets WHERE required_php_snippets RLIKE(?) AND type = ?', $rlike, 'apache');
+					if(is_array($affected_snippets) && !empty($affected_snippets)) {
+						foreach($affected_snippets as $snippet) {
+							$sql_in[] = $snippet['directive_snippets_id'];
+						}
+						$affected_sites = $app->db->queryAllRecords('SELECT domain_id FROM web_domain WHERE server_id = ? AND directive_snippets_id IN ?', $conf['server_id'], $sql_in);
+					}
+				} elseif($this->dataRecord['type'] == 'apache') {
+					$affected_sites = $app->db->queryAllRecords('SELECT domain_id FROM web_domain WHERE server_id = ? AND directive_snippets_id = ?', $conf['server_id'], $this->dataRecord['directive_snippets_id']);
+				}
+
+				if(is_array($affected_sites) && !empty($affected_sites)) {
+					foreach($affected_sites as $site) {
+						$website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $site['domain_id']);
+						$app->db->datalogUpdate('web_domain', $website, 'domain_id', $site['domain_id'], true);
+					}
+				}
+			}
+		}
+	}
+
+	public function onSubmit() {
+		global $app;
+
 		if($this->id > 0){
 			$record = $app->db->queryOneRecord("SELECT * FROM directive_snippets WHERE directive_snippets_id = ?", $this->id);
 			if($record['master_directive_snippets_id'] > 0){
 				unset($app->tform->formDef["tabs"]['directive_snippets']['fields']['name'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['type'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['snippet'], $app->tform->formDef["tabs"]['directive_snippets']['fields']['required_php_snippets']);
 			}
-	
-			if(isset($this->dataRecord['update_sites'])) {
-				parent::onSubmit();
-			} else {
-				$app->db->query('UPDATE directive_snippets SET name = ?, type = ?, snippet = ?, customer_viewable = ?, required_php_snippets = ?, active = ? WHERE directive_snippets_id = ?', $this->dataRecord['name'], $this->dataRecord['type'], $this->dataRecord['snippet'], $this->dataRecord['customer_viewable'], implode(',', $this->dataRecord['required_php_snippets']), $this->dataRecord['active'], $this->id);
-
-	            if($_REQUEST["next_tab"] == '') {
-    	            $list_name = $_SESSION["s"]["form"]["return_to"];
-                	if($list_name != '' && $_SESSION["s"]["list"][$list_name]["parent_name"] != $app->tform->formDef["name"]) {
-                    	$redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
-	                    $_SESSION["s"]["form"]["return_to"] = '';
-    	                session_write_close();
-        	            header($redirect);
-                	} elseif (isset($_SESSION["s"]["form"]["return_to_url"]) && $_SESSION["s"]["form"]["return_to_url"] != '') {
-	                    $redirect = $_SESSION["s"]["form"]["return_to_url"];
-    	                $_SESSION["s"]["form"]["return_to_url"] = '';
-        	            session_write_close();
-            	        header("Location: ".$redirect);
-                	    exit;
-                	} else {
-                    	header("Location: ".$app->tform->formDef['list_default']);
-                	}
-                	exit;
-				}
-			}
-
-			unset($record);
 		}
 
 		parent::onSubmit();
 	}
-	
+
 }
 
 $page = new page_action;
-$page->onLoad();
-
-?>
+$page->onLoad();
\ No newline at end of file
diff --git a/interface/web/admin/templates/directive_snippets_edit.htm b/interface/web/admin/templates/directive_snippets_edit.htm
index b01e7e255c82007a9c974a794a84a0907ffc46d6..d96ea724ae6695d59a13dcf1a0a2437042673cfd 100644
--- a/interface/web/admin/templates/directive_snippets_edit.htm
+++ b/interface/web/admin/templates/directive_snippets_edit.htm
@@ -17,12 +17,14 @@
 				</div></tmpl_if>
             </div>
             <tmpl_if name='is_master'></tmpl_else>
+			<tmpl_if name='required_php_snippets'>
 			<div class="form-group php">
                 <label class="col-sm-3 control-label">{tmpl_var name='required_php_snippets_txt'}</label>
                 <div class="col-sm-9">
                     {tmpl_var name='required_php_snippets'}
                 </div>
             </div>
+			</tmpl_if>
             </tmpl_if>
 			<div class="form-group">
                 <label class="col-sm-3 control-label">{tmpl_var name='customer_viewable_txt'}</label>
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index a718ae8a87aab05cfd8385cc72c35b457ec7fdc6..69526f8da9afbcda23d872c717dcf364b07ee9e1 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -854,11 +854,12 @@ class page_action extends tform_actions {
 			$directive_snippets_id_select .= '</optgroup>';
 		}
 
-		if($is_admin) {
+		// it does not make sense to display those for admins as they are NOT applied to vhosts anyway!
+		/*if($is_admin) {
 			$directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type);
-		} else {
+		} else {*/
 			$directive_snippets = $app->db->queryAllRecords("SELECT directive_snippets_id, name FROM directive_snippets WHERE customer_viewable = 'y' AND active = 'y' AND master_directive_snippets_id = 0 AND type = ? ORDER BY name ASC", $server_type);
-		}
+		//}
 		if(is_array($directive_snippets) && !empty($directive_snippets)){
 			$directive_snippets_id_select .= '<optgroup label="'.$app->tform->wordbook["select_directive_snippet_txt"].'">';
 			foreach($directive_snippets as $directive_snippet){
diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index 609e9212dc3a6fd6b6a74c2fcb3b9622039a915c..12ad81ef9cd38db186728d0517e8a73422f03904 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -65,8 +65,7 @@ class web_module {
 		'aps_package_delete',
 		'aps_setting_insert',
 		'aps_setting_update',
-		'aps_setting_delete',
-		'directive_snippets_update'
+		'aps_setting_delete'
 	);
 
 	//* This function is called during ispconfig installation to determine
@@ -117,7 +116,6 @@ class web_module {
 		$app->modules->registerTableHook('aps_instances_settings', 'web_module', 'process');
 		$app->modules->registerTableHook('aps_packages', 'web_module', 'process');
 		$app->modules->registerTableHook('aps_settings', 'web_module', 'process');
-		$app->modules->registerTableHook('directive_snippets', 'web_module', 'process');
 
 		// Register service
 		$app->services->registerService('httpd', 'web_module', 'restartHttpd');
@@ -189,11 +187,6 @@ class web_module {
 			if($action == 'u') $app->plugins->raiseEvent('aps_setting_update', $data);
 			if($action == 'd') $app->plugins->raiseEvent('aps_setting_delete', $data);
 			break;
-		case 'directive_snippets':
-			if($action == 'i') $app->plugins->raiseEvent('directive_snippets_insert', $data);
-			if($action == 'u') $app->plugins->raiseEvent('directive_snippets_update', $data);
-			if($action == 'd') $app->plugins->raiseEvent('directive_snippets_delete', $data);
-			break;
 		} // end switch
 	} // end function
 
@@ -229,7 +222,7 @@ class web_module {
 		} else {
 			$cmd = $app->system->getinitcommand($daemon, 'reload');
 		}
-		
+
 		if($web_config['server_type'] == 'nginx'){
 			$app->log("Checking nginx configuration...", LOGLEVEL_DEBUG);
 			exec('nginx -t 2>&1', $retval['output'], $retval['retval']);
@@ -240,16 +233,16 @@ class web_module {
 				return $retval;
 			}
 		}
-		
+
 		exec($cmd.' 2>&1', $retval['output'], $retval['retval']);
-		
+
 		// if restart failed despite successful syntax check => try again
 		if($web_config['server_type'] == 'nginx' && $retval['retval'] > 0){
 			sleep(2);
 			exec($cmd.' 2>&1', $retval['output'], $retval['retval']);
 		}
 		$app->log("Restarting httpd: $cmd", LOGLEVEL_DEBUG);
-		
+
 		// nginx: do a syntax check because on some distributions, the init script always returns 0 - even if the syntax is not ok (how stupid is that?)
 		//if($web_config['server_type'] == 'nginx' && $retval['retval'] == 0){
 			//exec('nginx -t 2>&1', $retval['output'], $retval['retval']);
@@ -272,7 +265,7 @@ class web_module {
 		} else {
 			$path_parts = pathinfo($init_script);
 			$initcommand = $app->system->getinitcommand($path_parts['basename'], $action, $path_parts['dirname']);
-			
+
 			if($action == 'reload' && $init_script == $conf['init_scripts'].'/'.$web_config['php_fpm_init_script']) {
 				// we have to do a workaround because of buggy ubuntu fpm reload handling
 				// @see: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1242376
@@ -289,7 +282,7 @@ class web_module {
 					}
                                         */
 					unset($tmp);
-				}	
+				}
 			}
 			/*
 			if($action == 'reload') {
diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index c9ed6508e06124ce5cb0733072f1f3c891b4ed18..76ab4f7c4f72e05cec7947f35b01ff36ce43dede 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -95,34 +95,6 @@ class apache2_plugin {
 		$app->plugins->registerEvent('ftp_user_delete', $this->plugin_name, 'ftp_user_delete');
 
 		$app->plugins->registerAction('php_ini_changed', $this->plugin_name, 'php_ini_changed');
-
-		$app->plugins->registerEvent('directive_snippets_update', $this->plugin_name, 'directive_snippets');
-	}
-
-	function directive_snippets($event_name, $data) {
-		global $app, $conf;
-
-		$snippet = $data['new'];
-		if($snippet['active'] == 'y' && $snippet['update_sites'] == 'y') {
-			if($snippet['type'] == 'php') {
-				$rlike = $snippet['directive_snippets_id'].'|,'.$snippet['directive_snippets_id'].'|'.$snippet['directive_snippets_id'].',';
-				$affected_snippets = $app->db->queryAllRecords('SELECT directive_snippets_id FROM directive_snippets WHERE required_php_snippets RLIKE(?) AND type = ?', $rlike, 'apache');
-				if(is_array($affected_snippets) && !empty($affected_snippets)) {
-					foreach($affected_snippets as $snippet) $sql_in[] = $snippet['directive_snippets_id'];
-					$affected_sites = $app->db->queryAllRecords('SELECT domain_id FROM web_domain WHERE server_id = ? AND directive_snippets_id IN ?', $conf['server_id'], $sql_in);
-				}
-			}
-			if($snippet['type'] == 'apache') $affected_sites = $app->db->queryAllRecords('SELECT domain_id FROM web_domain WHERE server_id = ? AND directive_snippets_id = ?', $conf['server_id'], $snippet['directive_snippets_id']);
-
-			if(is_array($affected_sites) && !empty($affected_sites)) {
-				foreach($affected_sites as $site) {
-					$website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $site['domain_id']);
-					$new_data['old'] = $website;
-					$new_data['new'] = $website;
-					$this->update('web_domain_update', $new_data);
-				}
-			}
-		}
 	}
 
 	private function get_master_php_ini_content($web_data) {
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index a2673b62a2135a2ed6aff279096fd4504a902ced..b1d2f773b0b49660d28255b04a9110d210664316 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -90,35 +90,6 @@ class nginx_plugin {
 
 		$app->plugins->registerEvent('web_folder_update', $this->plugin_name, 'web_folder_update');
 		$app->plugins->registerEvent('web_folder_delete', $this->plugin_name, 'web_folder_delete');
-
-		$app->plugins->registerEvent('directive_snippets_update', $this->plugin_name, 'directive_snippets');
-	}
-
-	function directive_snippets($event_name, $data) {
-		global $app, $conf;
-
-		$snippet = $data['new'];
-
-		if($snippet['active'] == 'y' && $snippet['update_sites'] == 'y') {
-			if($snippet['type'] == 'php') {
-				$rlike = $snippet['directive_snippets_id'].'|,'.$snippet['directive_snippets_id'].'|'.$snippet['directive_snippets_id'].',';
-				$affected_snippets = $app->db->queryAllRecords('SELECT directive_snippets_id FROM directive_snippets WHERE required_php_snippets RLIKE(?) AND type = ?', $rlike, 'nginx');
-				if(is_array($affected_snippets) && !empty($affected_snippets)) {
-					foreach($affected_snippets as $snippet) $sql_in[] = $snippet['directive_snippets_id'];
-					$affected_sites = $app->db->queryAllRecords('SELECT domain_id FROM web_domain WHERE server_id = ? AND directive_snippets_id IN ?', $conf['server_id'], $sql_in);
-				}
-			}
-			if($snippet['type'] == 'nginx') $affected_sites = $app->db->queryAllRecords('SELECT domain_id FROM web_domain WHERE server_id = ? AND directive_snippets_id = ?', $conf['server_id'], $snippet['directive_snippets_id']);
-
-			if(is_array($affected_sites) && !empty($affected_sites)) {
-				foreach($affected_sites as $site) {
-					$website = $app->db->queryOneRecord('SELECT * FROM web_domain WHERE domain_id = ?', $site['domain_id']);
-					$new_data['old'] = $website;
-					$new_data['new'] = $website;
-					$this->update('web_domain_update', $new_data);
-				}
-			}
-		}
 	}
 
 	// Handle the creation of SSL certificates