diff --git a/src/invidious.cr b/src/invidious.cr
index 5373a84d..e5c5553e 100644
--- a/src/invidious.cr
+++ b/src/invidious.cr
@@ -269,12 +269,14 @@ get "/search" do |env|
   templated "search"
 end
 
-get "/:path" do |env|
-  env.redirect "/"
+error 404 do |env|
+  error_message = "404 Page not found"
+  templated "error"
 end
 
 error 500 do |env|
-  templated "index"
+  error_message = "500 Server error"
+  templated "error"
 end
 
 public_folder "assets"