Next.js (App Router)
Place the snippet in your not-found component or 404 page so it runs when a 404 is rendered.
app/not-found.tsx or app/404/page.tsxStart with one snippet on your existing 404 page. Upgrade later if you want advanced routing.
Avoid storing raw IPs; prefer hashing/truncation.
The snippet below is an example. Replace the data attributes with your values.
Keep the original 404 status (don’t blanket-redirect). The snippet reports the broken request and lets you show recovery links to users.
app/not-found.tsx or app/404/page.tsxsrc/components/NotFound.jsxwp-content/themes/your-theme/404.phptemplates/404.liquidIf you need help, contact me.
Quick answers to common questions.