Support Forums

Base path redirect rule is not working

I’m building a simple internationalized next.js website.
Repo here: https://github.com/AustinShelby/Wowza
Deployed here: https://blissful-lamarr-6d96de.netlify.app/

I want the redirect rules to work in the following way:

/ redirects to /en
/catchall redirects to /en

Only the second rule is working correctly. The first one doesn’t do anything

My current next.config.js:

module.exports = {
  reactStrictMode: true,
  i18n: {
    locales: ["en", "de", "catchall"],
    defaultLocale: "catchall",

and netlify.toml:

  from = "/catchall"
  to = "/en"
  status = 301
  force = true

  from = "/"
  to = "/en"
  status = 301
  force = true

The idea is to have a website with only paths that start with either en or de. Using the i18n in next.js this is currently impossible as the default locale doesn’t get added to the path.

Ok I managed to fix it myself.

I deleted the netlify.toml file and instead created a _redirects file with these contents:

/ /en 301!
/catchall /en 301!

and changed my build command to this: yarn build && cp _redirects .next