Have spent a couple hours now going round in absolute circles trying to get a simple redirect working from the netlfiy subdomain to my custom domain.
Using next js singe page experience approach.
It doesn’t help that I’m one of these dreaded vibe coders who has no clue about anything.
I’ve tried so many different options and routes now, and still nothing has any effect. Have installed the netlify plugin to my codebase, have tried tomls and redirects and post build instructions.
Shall I try standing on one leg? Waiting for some planets to align?
Why is there not just a simple toggle in the Dashboard UI for: “redirect to custom domain” ?
What is the latest sure fire way to get this working?
@willvibes Sorry, I initially linked to older documentation, and it looks like the newer documentation doesn’t address it in the same way.
As I understand it, (which you’ll have to take with a grain of salt as I don’t work with Next.js myself), when you’re working with Next.js since it runs everything through functions you’re supposed to do things in a Next.js way. So you would do your redirects/rewrites however Next.js wants you to.
The current documentation here:
Indicates:
With the limitation:
The Netlify redirects via _redirects and netlify.toml predate Next.js support on Netlify and only come into effect when the request is being handled by Netlify and not intercepted by Next.js’ middleware.
Wow thanks for your super quick and diligent replies.
To be honest I can’t make head nor tail of it. I’ve pointed Cursor to your links and it’s tried middleware (as it understands that what it needs to do) but still no joy.
I’ll just … come back to this later.
So weird.
Netlify really need to make this a simple UI toggle or default behaviour. Why would you not want this to be the normal behaviour when you add a custom domain?