If you're promoting a mobile app for both iOS and Android and want a single URL or QR code that drops users into the correct store, you don't need a 3rd-party redirect service. A NextJS middleware that matches userAgent against iP(hone|ad|od) and Android regexes does it in ~15 lines, runs before any render, and keeps the contact point — and any SEO it earns — on your own domain.
The full post walks through the middleware.ts plus the placeholder app/get.tsx page that triggers it, with notes on the iOS-vs-Android UX quirk and why owning that redirect matters once QR codes are out in the wild and outlive your vendor relationships.
Originally published at andreasbergstrom.dev — read the full post there.
Top comments (1)
Thank you