comparison index.php @ 9:5db51091e291

Directory may turn file. Return 302 instead of 301.
author edogawaconan <me@myconan.net>
date Tue, 21 Oct 2014 21:50:20 +0900
parents ac946673f830
children 9abfd376740d
comparison
equal deleted inserted replaced
8:ac946673f830 9:5db51091e291
21 if ($root === null || $root === "") { $root = $_SERVER["DOCUMENT_ROOT"]; } 21 if ($root === null || $root === "") { $root = $_SERVER["DOCUMENT_ROOT"]; }
22 22
23 if (realpath($root . $path) === false) { 23 if (realpath($root . $path) === false) {
24 header("HTTP/1.0 404 Not Found"); 24 header("HTTP/1.0 404 Not Found");
25 } elseif (substr($path, -1) !== "/") { 25 } elseif (substr($path, -1) !== "/") {
26 header("Location: " . $path . "/", false, 301); 26 header("Location: " . $path . "/");
27 } 27 }
28 28
29 if (http_response_code() !== 200) { exit; } 29 if (http_response_code() !== 200) { exit; }
30 30
31 $dir_handle = @opendir($root . $path); 31 $dir_handle = @opendir($root . $path);