diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-11-05 06:03:38 +0000 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-11-05 06:03:38 +0000 |
commit | 141e9b1c8f9a53b3df94a01a925b88a40d847551 (patch) | |
tree | 8b5f3101a6cb56a848ca94a498d280c4ee375a71 /index.php | |
parent | 7b54cb36f7e0b6230b20466976ada9b687b39dcb (diff) |
add a trailing slash to directory URLs.
Besides saving a redirect, this is also a step towards making
parabolaweb `manage.py syncisos` work.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -169,7 +169,13 @@ if (!is_dir($root.'/'.$dirname)) { echo "\t\t\t\t<tr class=\"".implode(' ', $classes)."\">"; echo "<td>"; - echo "<a href=\"".htmlentities($filename)."\">".htmlentities($filename)."</a>"; + 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 "<a href=\"".htmlentities($filename)."/\">".htmlentities($filename)."</a>"; + } else { + echo "<a href=\"".htmlentities($filename)."\">".htmlentities($filename)."</a>"; + } if (stat_is_link($stat)) { $target = readlink($root.'/'.$dirname.'/'.$filename); echo " -> <a href=\"".htmlentities($target)."\">".htmlentities($target)."</a>"; |