Issue with Redirect Rule in Netlify

Hello Netlify Support Team,

I have added the following rule to my _redirects file to redirect individual subpages of completed investments to a page listing all completed investments:

/inwestycje-zrealizowane/* /inwestycje-zrealizowane 301!

However, this rule does not seem to be working as expected. Could you please help me understand if there is an issue with the syntax or if there might be another reason why this redirect is not functioning?

Thank you for your assistance.

Best regards

Site: https://www.victoriadom.pl/
Site ID: 25bffaf5-f63c-4bab-b0b2-0886f9ffc1d3

@inDigital Have you confirmed that the _redirects file is in your Publish directory once your build has executed? (Run your build command locally and then check the output to confirm)

Have you checked your build log to see if the redirect rule was detected?

I have checked the output folder of the build, and the netlify.toml file is present with the following rule:

[[redirects]]
  from = "/inwestycje-zrealizowane/*"
  to = "/inwestycje-zrealizowane"
  status = 301
  force = true

However, the redirect still does not seem to be working as expected.

@inDigital The netlify.toml and _redirects don’t have the same placement.

_redirects file location

https://docs.netlify.com/routing/redirects/

Save a plain text file called _redirects without a file extension to the publish directory of your site.

netlify.toml file location

https://docs.netlify.com/configure-builds/file-based-configuration/#file-location

The netlify.toml is normally stored in the root of your site repository.

We are defining our redirect rules in a _redirects file, which we place in the [static] folder (the contents of which are copied to [public] during the build process). When checking the build output on Netlify, there is only [netlify.toml] file in the root folder. However, it contains all the rules we defined in _redirects, and all the rules work except for the one with the wildcard.

Here is the rule that is not working:

/inwestycje-zrealizowane/* /inwestycje-zrealizowane 301!

Could you please help us understand why this specific rule with the wildcard is not functioning as expected?

Thank you for your assistance.

Unfortunately, no I cannot.
Not without seeing the files.

I don’t work for Netlify, so I have zero visibility.

Since you seem to describe having the same rules in your netlify.toml as your _redirects I’m not confident of which of those two files is being applied.

The rule as described should work, so I’d expect the issue to either be another rule clashing with it due to the Rule processing order or something else impacting it (as edge functions, middleware, service workers sometimes do).

I don’t see any obvious issues here so I have asked the devs to take a look.

Hello,

Just checking in to see if there have been any updates or insights from the dev team regarding the issue.

Thanks in advance.

The redirect is not working because we detect the loop and break it. I believe you might be able to do the following:

[[redirects]]
  force = true
  from = "/inwestycje-zrealizowane/"
  to = "/inwestycje-zrealizowane"
  status = 200

[[redirects]]
  force = true
  from = "/inwestycje-zrealizowane/*"
  to = "/inwestycje-zrealizowane"
  status = 301