NextJS (next.config.js) redirects not working

At some point (not sure when, just noticed yesterday), all of my NextJS redirects (in next.config.js) stopped working on Netlify. I tried building/serving locally via netlify serve and they do not work locally either.

Running the NextJS server locally works.

site name: unityescaperooms.netlify.app
recent buildID: 646daf3db6055000087fa2cd
dependency versions:
@netlify/plugin-nextjs: v4.37.2
next: v13.4.3

I’ve manually verified that my redirects() function in next.config.js returns the following:

[
  {
    source: '/',
    has: [{ type: 'query', key: 's' }],
    destination: '/search',
    permanent: true
  },
  {
    source: '/team-building',
    destination: '/events/team-building',
    permanent: true
  },
  {
    source: '/birthday-party',
    destination: '/events/birthday-party-celebration',
    permanent: true
  },
  {
    source: '/events/birthday-party',
    destination: '/events/birthday-party-celebration',
    permanent: true
  },
  {
    source: '/team-building',
    destination: '/events/team-building',
    permanent: true
  },
  {
    source: '/privacy-policy',
    destination: '/legal/privacy-policy',
    permanent: true
  },
  {
    source: '/terms-of-service',
    destination: '/legal/terms-of-service',
    permanent: true
  },
  { source: '/contact-us', destination: '/contact', permanent: true },
  {
    source: '/the-toy-shop',
    destination: '/redlands/soul-shop',
    permanent: true
  },
  {
    source: '/infection',
    destination: '/redlands/infection',
    permanent: true
  },
  { source: '/jobs', destination: '/careers', permanent: true },
  { source: '/brand', destination: '/brand/overview', permanent: true },
  {
    source: '/killers-lodge',
    destination: '/rancho-cucamonga/killers-lodge',
    permanent: true
  },
  {
    source: '/kitchen-nightmare',
    destination: '/rancho-cucamonga/kitchen-nightmare',
    permanent: true
  },
  {
    source: '/person-of-interest',
    destination: '/rancho-cucamonga/person-of-interest',
    permanent: true
  },
  {
    source: '/soul-shop',
    destination: '/redlands/soul-shop',
    permanent: true
  },
  {
    source: '/the-cabin',
    destination: '/redlands/the-cabin',
    permanent: true
  },
  {
    source: '/tomb-of-pharaoh',
    destination: '/rancho-cucamonga/tomb-of-pharaoh',
    permanent: true
  },
  {
    source: '/wizard-escape',
    destination: '/redlands/wizard-escape',
    permanent: true
  }
]

None of these redirects work. e.g.
https://unityescaperooms.com/team-buildingTeam Building and Corporate Events - Unity Escape Rooms
https://unityescaperooms.com/jobsCareers - Unity Escape Rooms
Wizard Escape - Redlands - Unity Escape RoomsWizard Escape - Redlands - Unity Escape Rooms

I know this used to work, but I’m not sure at what point it stopped working.

I do not use _redirects, but I do have a single [[redirect]] declaration in my netlify.toml (to address this previous issue)

Hi @eoneill, thanks for the post.
If you have not read the blog post below already about Nextjs redirects and rewrites on Netlify, Kindly do so to see if it helps.

Thanks.

1 Like

We have a Next.js site that implements redirects using the next.config file. It has worked perfectly fine in production for a while, but all of a sudden it stopped working. We haven’t changed the configuration for the redirects at all. we have tried using the _redirects file as well, put it in the public folder. on the dashboard, it says that it detected 69 redirect rules (the amount we added). but the redirects don’t work on the production site. Nothing is working.

I don’t see any site details shared here.

I’m happy to help, but what more do you want? When we switched to Vercel, it was also an issue with middleware redirecting.

You have two sites tied to this account so ideally your site name or site ID so we can identify which site you’re running into this issue. :slightly_smiling_face:

its the ironcovesolution.com site, not the test.

Could you also mention which redirects are not working? What’s the expected behaviour here?

I have a lot of redirects, they are just doing simple redirects to new pages. Nothing more or less but simple ones.

@ironcove It doesn’t matter how many you have, or if they’re simple or complex, what Netlify are requesting is that you point to a specific one that’s not working.

It’s so they can quickly check it themselves without wasting any of their time.

Can you point to a specific redirect on your site that’s not working?

what if I don’t have it hosted on netlify anymore? I had to move it. Happy to do a Zoom with someone, but I couldn’t wait for the message board to answer my questions, unfortunately. A link that was not working on netlify was Leading Okta Partner & Reseller | Enterprise Identity Cloud Solutions | Iron Cove Solutions and we needed it forwarded to Leading Okta Partner & Reseller | Enterprise Identity Cloud Solutions | Iron Cove Solutions

Then it’s probably not worth any further action unless you’re planning to re-host it on Netlify.

I can’t speak for Netlify, as I don’t work for them, but a minimum reproduction is likely to be more useful.

Netlify would need to see the source code of the implementation.

That’s perfectly fine.
Hopefully it’s all working great where you’ve got it hosted currently.

If you are seeking to host it on Netlify you’ll just need to provide more specific details.