next.config.js
, you must set the trailingSlash
option to the desired value. The default for Next.js is to redirect URLs with trailing slashes to no trailing slashes.trailingSlash
option available in your gatsby-config.js
. For Gatsby v4, the default for this is legacy
, which preserves what URL was provided. In Gatsby v5, the default for this is always
, which will redirect all URLs to ones with trailing slashes.npm
/yarn
, using netlify.toml
in the root of your repository, or manually in the Netlify UI. We'll leave it up to you to pick the method that works best for you, though we favor npm
/yarn
and/or using netlify.toml
. Further installation instructions can be found in the links above.gatsby-plugin-netlify
and add it to your gatsby-config.js
so that Gatsby can generate Netlify specific artifacts as a part of its build. This plugin is included by default in our starters; you should just check that it's there and add it if not.index.html
files living inside of a folder that matches the request path. Using the above example of https://example.com/shop
, that page actually exists in the filesystem as /shop/index.html
. For legacy web reasons, index.html
has a special meaning to web servers that, when requesting a directory, return the index.html
file when /shop/
is requested. All this to say that Netlify is able to do trailing slashes out of the box because of how web servers work.200 Ok
response is returned instead of a 301
.