Adrià Vilanova MartÃnez | 4b0d8f1 | 2021-07-23 00:38:31 +0200 | [diff] [blame] | 1 | <?php |
2 | require_once('redirects.php'); | ||||
3 | |||||
4 | $path = $_GET['q'] ?? '/'; | ||||
5 | foreach ($redirects as $r) { | ||||
6 | if (preg_match($r['pattern'], $path) === 1) { | ||||
7 | $location = preg_replace($r['pattern'], $r['redirect'], $path); | ||||
8 | header('Location: '.$location); | ||||
9 | exit; | ||||
10 | } | ||||
11 | } | ||||
12 | |||||
13 | http_response_code(404); |