summaryrefslogtreecommitdiff
path: root/dev-server.php
diff options
context:
space:
mode:
authorJonas Kohl <gitlab@jonaskohl.de>2024-07-20 13:34:47 +0200
committerJonas Kohl <gitlab@jonaskohl.de>2024-07-20 13:34:47 +0200
commit97c7e0fe43d04d2139f7eb9b4428e3ab3ae006ed (patch)
tree3b444f0f1f74afce077dac6ff5da0696f152a41f /dev-server.php
parent19cca027b9f7ee21215e0e5fca8568dcf01853c1 (diff)
Add redirection if accessed with '.html' extension
Brings the behavior more in line with Neocities
Diffstat (limited to 'dev-server.php')
-rw-r--r--dev-server.php6
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;