Vercel.json redirects

In vercel.json I am using the redirects array to configure a bunch of redirects. One of them has () brackets in the redirect destination and I cannot work out how to get it to work correctly. The Next docs suggest doing “redirect-\(brackets\)-path” works but this fails in Vercel with Redirect at index xxx has segment ":__UN_NAMED_SEGMENT__" in `destination` property but not in `source` or `has` property.

Sample redirect:

"redirects": [{
  "source": "/test",
  "destination": "test-\\(not-really\\)"
}]

Should be enough to show the error

No framework, just vercel.json and a statically generated site

The way it’s configured is making the system interpret that part of the destination as a segment parameter. Instead, you could try to encode the special characters, use dynamic redirects, or switch to the legacy routes property.

Please let me know if you give those options a try and still have any trouble with it :slightly_smiling_face:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.