The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
fix not-found implementation
Steven Teyfe0db584e9ad
diff --git a/apps/web/app/[domain]/not-found/page.tsx b/apps/web/app/[domain]/not-found/page.tsxnew file mode 100644index 0000000000..31b42c81f0--- /dev/null+++ b/apps/web/app/[domain]/not-found/page.tsx@@ -0,0 +1,32 @@+import { GlobeSearch } from "@dub/ui";+import { constructMetadata } from "@dub/utils";++export const runtime = "edge";++export const metadata = constructMetadata({+ title: "Link Not Found – Dub.co",+ description:+ "This link does not exist on Dub.co. Please check the URL and try again.",+ image: "https://assets.dub.co/misc/notfoundlink.jpg",+ noIndex: true,+});++export default async function NotFoundLinkPage() {+ return (+ <div className="z-10 mx-2 my-10 flex max-w-md flex-col items-center space-y-5 px-2.5 text-center sm:mx-auto sm:max-w-lg sm:px-0 lg:mb-16">+ <div className="font-display mx-auto flex h-20 w-20 items-center justify-center rounded-full border border-gray-300 bg-white/80 text-lg font-bold text-gray-400">+ <GlobeSearch className="size-6 text-gray-500" />+ </div>+ <h1 className="font-display text-5xl font-bold">Link Not Found</h1>+ <p className="text-lg text-gray-600">+ This link does not exist. Please check the URL and try again.+ </p>+ <a+ href="https://dub.co/home"+ className="rounded-full bg-gray-800 px-10 py-2 font-medium text-white transition-colors hover:bg-black"+ >+ Create Your Free Branded Link+ </a>+ </div>+ );+}diff --git a/apps/web/app/notfoundlink/page.tsx b/apps/web/app/notfoundlink/page.tsxdeleted file mode 100644index bc3369e4ae..0000000000--- a/apps/web/app/notfoundlink/page.tsx+++ /dev/null@@ -1,38 +0,0 @@-import { Background, Footer, GlobeSearch, Nav, NavMobile } from "@dub/ui";-import { constructMetadata } from "@dub/utils";--export const runtime = "edge";--export const metadata = constructMetadata({- title: "Link Not Found – Dub.co",- description:- "This link does not exist on Dub.co. Please check the URL and try again.",- image: "https://assets.dub.co/misc/notfoundlink.jpg",- noIndex: true,-});--export default async function NotFoundLinkPage() {- return (- <main className="flex min-h-screen flex-col justify-between">- <NavMobile />- <Nav />- <div className="z-10 mx-2 my-10 flex max-w-md flex-col items-center space-y-5 px-2.5 text-center sm:mx-auto sm:max-w-lg sm:px-0 lg:mb-16">- <div className="font-display mx-auto flex h-20 w-20 items-center justify-center rounded-full border border-gray-300 bg-white/80 text-lg font-bold text-gray-400">- <GlobeSearch className="size-6 text-gray-500" />- </div>- <h1 className="font-display text-5xl font-bold">Link Not Found</h1>- <p className="text-lg text-gray-600">- This link does not exist. Please check the URL and try again.- </p>- <a- href="https://dub.co/home"- className="rounded-full bg-gray-800 px-10 py-2 font-medium text-white transition-colors hover:bg-black"- >- Create Your Free Branded Link- </a>- </div>- <Footer />- <Background />- </main>- );-}diff --git a/apps/web/lib/middleware/link.ts b/apps/web/lib/middleware/link.tsindex 7714613db7..a66219c0fb 100644--- a/apps/web/lib/middleware/link.ts+++ b/apps/web/lib/middleware/link.ts@@ -81,7 +81,7 @@ export default async function LinkMiddleware(status: 302,});} else {- return NextResponse.rewrite(new URL("/notfoundlink", req.url), {+ return NextResponse.rewrite(new URL(`/${domain}/not-found`, req.url), {headers: DUB_HEADERS,});}