diff --git a/apps/block_scout_web/lib/block_scout_web/controller.ex b/apps/block_scout_web/lib/block_scout_web/controller.ex index fe2851c197..7f0d148d67 100644 --- a/apps/block_scout_web/lib/block_scout_web/controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controller.ex @@ -12,8 +12,9 @@ defmodule BlockScoutWeb.Controller do def not_found(conn) do conn |> put_status(:not_found) - |> put_view(BlockScoutWeb.ErrorView) - |> render("404.html") + |> put_view(BlockScoutWeb.PageNotFoundView) + |> Phoenix.Controller.render(:index) + |> halt() end def unprocessable_entity(conn) do diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/page_not_found_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/page_not_found_controller.ex new file mode 100644 index 0000000000..e453e5463b --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/page_not_found_controller.ex @@ -0,0 +1,8 @@ +defmodule BlockScoutWeb.PageNotFoundController do + use BlockScoutWeb, :controller + + def index(conn, _params) do + conn + |> render("index.html") + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/router.ex b/apps/block_scout_web/lib/block_scout_web/router.ex index aa19725811..48a5c8f8da 100644 --- a/apps/block_scout_web/lib/block_scout_web/router.ex +++ b/apps/block_scout_web/lib/block_scout_web/router.ex @@ -245,5 +245,7 @@ defmodule BlockScoutWeb.Router do get("/chain_blocks", ChainController, :chain_blocks, as: :chain_blocks) get("/api_docs", APIDocsController, :index) + + get("/:page", PageNotFoundController, :index) end end diff --git a/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex index 6850c2deb2..d91690ea9e 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/page_not_found/index.html.eex @@ -4,8 +4,8 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
+The requested path was not found on BlockScout.
Back Home