Redirects stopped working?

Hey, I noticed that _redirects file stopped working recently. Last week I was using the exact same configuration and it was perfectly fine… so I created this test site to find out what issue could it be.

https://redirects-test.netlify.com/ there are 2 pages - index and Test page. Redirects doesn’t work on either of them, however when I try to visit a page that doesn’t exist, for example /aaa - redirection works just fine. What is the problem here?

_redirects file configuration:
/ https://google.com
/* https://google.com

It looks as though you may need to force your redirects or delete those two pages.

I think you misunderstood the issue here. Redirections should work on any page, but at the moment it only works on pages that doesn’t exist. It just doesn’t make sense.

Did you read this?

Hi, @linasv, what @gregraven has said is exactly correct.

What you are seeing is the file shadowing behavior. Quoting the documentation about this:

By default, you can’t shadow a URL that actually exists within the site. This applies to rewrites using a splat or dynamic path segment as well as rewrites for individual routes or files.

The rules themselves look like this:

/   https://google.com
/*   https://google.com

If no status is specified as is done above, the rule is a 301 by default. So, the two rules above are equivalent to this:

/   https://google.com  301
/*   https://google.com 301

Also, these two files exist in the deployed files for this site:

  • index.html
  • test.html

This means these two URLs will not redirect because those “files” exist (note the “empty path” of / only will serve index.html):

There is no file example.html or example/index.html so the following URL does redirect:

If you want all URLs for redirect, even if a shadowed file does exist, then make the rules “forced” rules like so (adding the “!” to each 301 status):

/   https://google.com  301!
/*   https://google.com 301!

If there are other questions about this, please let us know.