filename ; } else { $dir_path = $_SERVER['DOCUMENT_ROOT'].$dir_url; } if(!preg_match("/\/$/", $dir_path)) $dir_path .= '/'; // check for index files and redirect if found foreach($config['index_files'] as $what) { if ( file_exists($dir_path.$what) ) { $redirect = basename($what); break; } } } if ( !empty($redirect) ) { if(!empty($_SERVER['SCRIPT_URI'])) { $scheme = parse_url($_SERVER['SCRIPT_URI']); $scheme = $scheme['scheme']; } else $scheme = $config['default_scheme']; if( !empty($_SERVER['QUERY_STRING']) ) $query_string = '?'.$_SERVER['QUERY_STRING']; header("Location: ".$scheme.'://'.$_SERVER['HTTP_HOST'].$dir_url.$redirect.$query_string); exit; } ?>