$list = array("select","update","delete"); foreach($list as $after) { foreach($_GET as $block) { if(preg_match("/".$after."/i",$_GET[$block]) header(location: [url]http://www.site.com);[/url] } }