Redirects allow you to automatically redirect an incoming request path to a new destination path. When you move or rename a file, you should make sure to set up a redirect from the old path to the new path, so that the old URL still takes users to the right place.

Redirects are configured in next.config.js and are checked before the filesystem (including pages and /public files ). The redirects function returns an array holding redirect objects.

To add a new redirect, add a new object in the redirects array with the following properties:

  • source: The incoming request path pattern.
  • destination: The new destination path you want to route to instead.
  • permanent: Whether the redirect is permanent and should be cached forever (true) or is temporary (false).

The example below adds a redirect for the alerts page after its parent folder was renamed from alerts-notifications to alerts.

redirects() {
    return [
        source: '/product/alerts-notifications/',
        destination: '/product/alerts/',
        permanent: true,
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").