diff options
-rw-r--r-- | index.php | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -11,6 +11,25 @@ $root = $_SERVER["DOCUMENT_ROOT"]; //$root = "/srv/http/repo/public/main"; $dirname = explode("?", $_SERVER["REQUEST_URI"], 2)[0]; +if (!is_dir($root.'/'.$dirname)) { + if (is_file($root.'/'.$dirname)) { + header('Content-Type: text/plain'); // gross, but if Nginx is "properly" configured, this only happens when serving itself, which is text + readfile($root.'/'.$dirname); + } else { + header("HTTP/1.0 404 Not Found"); + // This is the template used by Nginx internally; if you want something else, have Nginx intercept it. Separation of concerns. + ?><html> +<head><title>404 Not Found</title></head> +<body bgcolor="white"> +<center><h1>404 Not Found</h1></center> +<hr><center><?php echo $_SERVER["SERVER_SOFTWARE"]; ?></center> +</body> +</html> +<?php + } + exit(0); +} + function classify($root, $dirname, $filename) { global $repos_arch_project, $repos_arch_community, $repos_para_project, $repos_para_community; |