devshort

private self-hosted shortlink service
git clone https://git.clttr.info/devshort.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit 9ee1d2066d018b7fe07d49643d50be6bef789234
parent a8999f3160042b1dd3edc03fb1aed6d837963541
Author: Florian Kaldowski <flokX@users.noreply.github.com>
Date:   Fri, 22 Feb 2019 18:37:10 +0100

Redirect to index.php if there is no shortlink

At example, when accessing by a subdomain (https://link.example.com).
Diffstat:
Mredirect.php | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/redirect.php b/redirect.php @@ -31,6 +31,10 @@ if (array_key_exists($short, $config_content["shortlinks"])) { header("Location: " . $config_content["shortlinks"][$short], $http_response_code=303); count_access($base_path, $short); exit; +} else if ($short === "") { + header("Location: index.php", $http_response_code=301); + count_access($base_path, "Index"); + exit; } else { header("HTTP/1.1 404 Not Found"); count_access($base_path, "404-request");