0) { $baseurl = substr(trim(preg_replace('/(\?.*)/', '', $baseurl), '/'), 0, -strlen($dirty_req)); } else { $baseurl = preg_replace('/(\?.*)/', '', $baseurl); } if(strlen($dirty_req) > 0) { if(substr($_SERVER['REQUEST_URI'], -1) === '/') { $redirect_url = trim(full_url($_SERVER), '/'); header("HTTP/1.1 301 Moved Permanently"); header("Location: $redirect_url"); die; } } $request = $dirty_req; ob_start(); $r = getRequestPage($request); $GLOBALS['args'] = $r[1]; if(empty($r[0])) { if(empty($r[1])) { include $basedir . 'pages/home.php'; } else { include error(404); } } else { include $basedir.'pages/'.implode('/', $r[0]).'.php'; } $html = ob_get_clean(); echo $html;