drnk.me/controllers/slug/GET.php

15 lines
283 B
PHP
Raw Permalink Normal View History

2023-11-29 21:17:08 +00:00
<?php
2023-11-29 21:40:15 +00:00
require_once(ROOT . "/utils/error.php");
2023-11-29 21:17:08 +00:00
return function (array &$context) {
2023-11-29 21:40:15 +00:00
$path = substr($context[REQUEST_PATH], 1);
$url = $context[REPOSITORIES]->urls->getBySlug($path);
if (!$url) {
redirect("/");
} else {
redirect($url->url);
}
2023-11-29 21:17:08 +00:00
};