1) $uri = $tmp[0]; foreach(explode("/",$uri) as $x){ if (strpos($x,".php") === False && strlen($x) != 0){ $path .= "../"; } if (!$found && stripos($x,"fannie") !== False){ $found = True; $path = ""; } } ?> <?php echo $page_title; ?>