Syntax for the _redirects file

Hello all. Recently, I received an email about changes in redirects. Where do I need to specify at the end of the redirect:

! and redirect status code -> example ! 301

The email contained part of the redirects, please tell me if this applies to all redirects (in _redirects file) or only the specified ones?

Regards,
Artur.

Hey @arturmikheyankou,

You’ll want to look at the redirects in your _redirects file and check that they have the ! if you want to force the redirect. The changes to redirects can be boiled down to:

If you have a redirect rule that’s not explicitly marked as forced, and you also have a file under the same path, we will serve the file.

and our CTO goes into much more detail in his post here:

The syntax for a forced redirect would be:

/new-home.html   /old-home.html   301!

The syntax for an unforced redirect (that enables shadowing) would be:

/tshirts/*   /other-summer-clothes.html   301

Let us know if we can answer any other questions about this!

1 Like