From 141e9b1c8f9a53b3df94a01a925b88a40d847551 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 5 Nov 2017 06:03:38 +0000 Subject: add a trailing slash to directory URLs. Besides saving a redirect, this is also a step towards making parabolaweb `manage.py syncisos` work. --- index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'index.php') diff --git a/index.php b/index.php index 6a58209..44c56e4 100644 --- a/index.php +++ b/index.php @@ -169,7 +169,13 @@ if (!is_dir($root.'/'.$dirname)) { echo "\t\t\t\t"; echo ""; - echo "".htmlentities($filename).""; + if (stat_is_dir($stat)) { + // stick a trailing slash on the URL; save a round-trip, since nginx will add it + // with a redirect + echo "".htmlentities($filename).""; + } else { + echo "".htmlentities($filename).""; + } if (stat_is_link($stat)) { $target = readlink($root.'/'.$dirname.'/'.$filename); echo " -> ".htmlentities($target).""; -- cgit v1.2.2