From a1352fc78d8886a3863b71d9cca51d1ac3d0650f Mon Sep 17 00:00:00 2001 From: Gautham Warrier Date: Sat, 22 Feb 2014 08:54:27 +0530 Subject: [PATCH] Fix Redirect Loop when there is no index.md --- libs/functions.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libs/functions.php b/libs/functions.php index 0dfa353..0c64245 100644 --- a/libs/functions.php +++ b/libs/functions.php @@ -478,9 +478,15 @@ function generate_page($options, $url_params, $base_url, $return=FALSE, &$flat_t } else { $homepage_url = "/"; } + + if($url_params[0]=='') + $homepage = TRUE; + else + $homepage = FALSE; + // Redirect to docs, if there is no homepage - if ($homepage_url !== '/') { - header('Location: '.$homepage_url); + if ($homepage && $homepage_url !== '/') { + header('Location: '.docs_url($tree)); } $docs_url = docs_url($tree); @@ -493,10 +499,7 @@ function generate_page($options, $url_params, $base_url, $return=FALSE, &$flat_t die; } - if($url_params[0]=='') - $homepage = TRUE; - else - $homepage = FALSE; + ob_start();