diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-21 20:54:52 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-21 20:54:52 -0400 |
commit | 1037a46baca97a364540b02a5d8f7886506df095 (patch) | |
tree | a5dee948623c3d93eebb41f4cd46fa550917933e | |
parent | 26f8a4faa66d2a3b4fba44f4b25c732ab11e2a04 (diff) |
remove self/404 handling--let nginx do it
-rw-r--r-- | index.php | 27 |
1 files changed, 0 insertions, 27 deletions
@@ -19,20 +19,6 @@ $dirname = explode("?", $_SERVER["REQUEST_URI"], 2)[0]; //////////////////////////////////////////////////////////////////////////////// -function show_404() { - // 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 -} - function normalizeN($filename) { $parts = preg_split("|/+|", $filename, -1, PREG_SPLIT_NO_EMPTY); $abs = substr($filename, 0, 1) === '/'; @@ -90,19 +76,6 @@ function classify($root, $dirname, $filename) { } //////////////////////////////////////////////////////////////////////////////// - -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"); - show_404(); - } - exit(0); -} - -//////////////////////////////////////////////////////////////////////////////// ?> <!DOCTYPE html> <html lang="en"> |