<?php | |
require_once('redirects.php'); | |
$path = $_GET['q'] ?? '/'; | |
foreach ($redirects as $r) { | |
if (preg_match($r['pattern'], $path) === 1) { | |
$location = preg_replace($r['pattern'], $r['redirect'], $path); | |
header('Location: '.$location); | |
exit; | |
} | |
} | |
http_response_code(404); |