changeset 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
files index.php
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/index.php	Thu Oct 30 11:39:11 2014 +0900
+++ b/index.php	Thu Oct 30 12:01:43 2014 +0900
@@ -12,7 +12,9 @@
   $uri = urldecode($uri);
 
   // $dir: filesystem path
-  $dir = isset($_SERVER["DL_DIR"]) ? $_SERVER["DL_DIR"] : $_SERVER["DOCUMENT_ROOT"] . $uri;
+  if (isset($_SERVER["DL_DIR"])) { $dir = $_SERVER["DL_DIR"]; }
+  elseif (isset($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $dir = $_SERVER["CONTEXT_DOCUMENT_ROOT"]; }
+  else { $dir = $_SERVER["DOCUMENT_ROOT"] . $uri; }
 
   if (realpath($dir) === false) {
     header("HTTP/1.0 404 Not Found");