'A', '/[]/'=>'a', '/[]/'=>'E', '/[]/'=>'e', '/[]/'=>'I', '/[]/'=>'i', '/[]/'=>'O', '/[]/'=>'o', '/[]/'=>'U', '/[]/'=>'u', '//'=>'c', '//'=> 'C'); //Replace $url = preg_replace(array_keys($charArray), array_values($charArray), $url); $url = str_replace ("-","_",$url); $url = str_replace (" ","-",$url); //Return return $url; } //Function explode folders function explodeUrl() { $result = array(); $folders = explode("/",$_SERVER['REQUEST_URI']); for ($x = 0; $x < count($folders); $x++) { if (trim($folders[$x])) { $result[count($result)] = $folders[$x]; } } return $result; } //Get folders $folders = explodeUrl(); //If not folder default page if (count($folders) == 0) { startPage(); //include("inicial.php"); //exit(0); //startPage(); } function startPage() { header("Location: http://" .$_SERVER['SERVER_NAME']. "/informatica/campo-bom"); exit(); } switch ($folders[0]) { case "les-brasil" : if (trim($folders[1])) { switch ($folders[1]) { case "fale-conosco" : $src = "Fale Conosco"; $subject = ""; $banner = "01"; $host = "/les-brasil/fale-conosco/"; include("fale-conosco.php"); break; case "orcamento" : $src = "Oramento"; $banner = "03"; $subject = "Oramento"; $host = "/les-brasil/orcamento/"; include("fale-conosco.php"); break; case "agendamento" : $src = "Agendamento de visita"; $subject = "Agendamento de visita"; $banner = "02"; $host = "/les-brasil/agendamento/"; include("fale-conosco.php"); break; default: startPage(); break; } }else{ include("inicial.php"); } break; case "informatica" : if (trim($folders[1])) { switch ($folders[1]) { case "novo-hamburgo" : $city = "Novo Hamburgo"; include("atendimento.php"); break; case "sapiranga" : $city = "Sapiranga"; include("atendimento.php"); break; case "campo-bom" : include("inicial.php"); break; case "manutencao" : include("assistencia-tecnica.php"); break; case "comercializacao" : include("comercializacao.php"); break; default: startPage(); break; } }else{ startPage(); } break; case "loja" : include("mapa.php"); break; default : //Page not found, default page. startPage(); } ?>