comparison index.php @ 26:eee7ca924a5e

Make it work with apache (at least XAMPP).
author edogawaconan <me@myconan.net>
date Thu, 30 Oct 2014 12:01:43 +0900
parents 69b2c15cadfb
children aa3f0003fb41
comparison
equal deleted inserted replaced
25:69b2c15cadfb 26:eee7ca924a5e
10 $uri = substr($uri, 0, $query_string_start); 10 $uri = substr($uri, 0, $query_string_start);
11 } 11 }
12 $uri = urldecode($uri); 12 $uri = urldecode($uri);
13 13
14 // $dir: filesystem path 14 // $dir: filesystem path
15 $dir = isset($_SERVER["DL_DIR"]) ? $_SERVER["DL_DIR"] : $_SERVER["DOCUMENT_ROOT"] . $uri; 15 if (isset($_SERVER["DL_DIR"])) { $dir = $_SERVER["DL_DIR"]; }
16 elseif (isset($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $dir = $_SERVER["CONTEXT_DOCUMENT_ROOT"]; }
17 else { $dir = $_SERVER["DOCUMENT_ROOT"] . $uri; }
16 18
17 if (realpath($dir) === false) { 19 if (realpath($dir) === false) {
18 header("HTTP/1.0 404 Not Found"); 20 header("HTTP/1.0 404 Not Found");
19 } elseif (substr($uri, -1) !== "/") { 21 } elseif (substr($uri, -1) !== "/") {
20 header("Location: " . $uri . "/"); 22 header("Location: " . $uri . "/");