<?php $name = filter_var($_GET['name'], FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH); $name= str_replace("%28","",$name); $name= str_replace("%29","",$name); $path = "/ece/faculty/"; $folder= str_replace("%20","_",$name); $file = $path.$folder."/index.php"; if ($file) { //header("HTTP/1.1 301 Moved Permanently"); header("Location: ".$file); } else { header("Location: ".$path); } exit();