From 97c7e0fe43d04d2139f7eb9b4428e3ab3ae006ed Mon Sep 17 00:00:00 2001 From: Jonas Kohl Date: Sat, 20 Jul 2024 13:34:47 +0200 Subject: Add redirection if accessed with '.html' extension Brings the behavior more in line with Neocities --- dev-server.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'dev-server.php') diff --git a/dev-server.php b/dev-server.php index dea55ab..0577fdd 100644 --- a/dev-server.php +++ b/dev-server.php @@ -27,8 +27,12 @@ $is_static = false; $name = ltrim($name, "/"); if (str_starts_with($name, "static/")) $is_static = true; -elseif (str_ends_with($name, ".html")) +elseif (str_ends_with($name, ".html")) { $name = preg_replace('/\.html$/', "", $name); + http_response_code(302); + header("Location: /$name"); + exit; +} $include_file = FALLBACK_FILE; -- cgit v1.2.3