diff options
author | Jonas Kohl | 2024-07-20 13:34:47 +0200 |
---|---|---|
committer | Jonas Kohl | 2024-07-20 13:34:47 +0200 |
commit | 97c7e0fe43d04d2139f7eb9b4428e3ab3ae006ed (patch) | |
tree | 3b444f0f1f74afce077dac6ff5da0696f152a41f | |
parent | 19cca027b9f7ee21215e0e5fca8568dcf01853c1 (diff) |
Add redirection if accessed with '.html' extension
Brings the behavior more in line with Neocities
-rw-r--r-- | dev-server.php | 6 |
1 files changed, 5 insertions, 1 deletions
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; |