summaryrefslogtreecommitdiff
path: root/mirror.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-22 17:16:21 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-22 17:16:21 -0400
commit7a1b09444b845ddad2222e1a9f37e3fbd2f75366 (patch)
treea46c5dfae6a6e24603b7c9a8636158b724df9d53 /mirror.php
parent1166729eee5aca1bc98f5a5d102da37689f4f2b8 (diff)
mirror: Ensure that directory URIs end with '/'.
Otherwise, relative paths don't work.
Diffstat (limited to 'mirror.php')
-rw-r--r--mirror.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/mirror.php b/mirror.php
index 0031d99..c8ad031 100644
--- a/mirror.php
+++ b/mirror.php
@@ -24,8 +24,12 @@ $filename = explode("?", $_SERVER["REQUEST_URI"], 2)[0];
if (!file_exists($root.'/'.$filename)) {
require $assetdir.'/404.php';
} elseif (is_dir($root.'/'.$filename)) {
- // Generate an index page
- require $assetdir.'/index.php';
+ if (substr("$filename", -1, 1) === "/") {
+ // Generate an index page
+ require $assetdir.'/index.php';
+ } else {
+ header('Location: '.$filename.'/');
+ }
} else {
$mirror = $tier0_url;
if (!should_force_tier0($filename)) {