FYI redirects of domains having another domain as a substring confuse Netlify

Netlify site name:
Custom DNS names:, and the apex versions of these, and the .com versions of all those.

I discovered that if my _redirects had (rule:* 301!) after, which was after the .ca versions of those domains, that the rule was process but not applied.

There appears to be an issue with substrings (i.e. thewildtechgarden must be before wildtechgarden because wildtechgarden is a substring of thewildtechgarden).

You may want to verify this isn’t confusing things across customers as well.

Also, the ZIP of the deploy I tried to download was reported as invalid by Windows 10 File Explorer (since I was following the redirects troubleshooting guide here on the forum).

Could you let me know which deploy (link me to the deploy logs in our UI) had the wrong redirect behavior, @danielfdickinson1 ? Would be happy to investigate a bit and get a bug filed or clarify where the config problem was if you could point me there so I am looking at the right thing :slight_smile:

1 Like

Thank you. The last deploy to production before I started making changes after noticing the issue (via Google Search Console notification), is:

This was also the deploy where the ZIP did not create a valid archive as far as Windows was concerned (Was it over some size limit, perhaps?)

I look forward to your analysis (hopefully it’s not some embarrassing mistake on my part…).

Thanks! Found the problem.

Your redirects file had a typo in it that screwed up that specific redirect. What you sent: 301!/develop-design/ /devel/ 301

…and that lack of carriage return made a very odd redirect that probably did nothing, in our database.

Looks like you’ve fixed it by now.


Thank you for looking. I bet I know how it happened too. The first one probably was exactly the length of my editor window, so the second wrapped to a newline visually, but not logically.

Thank you again, and sorry for the noise.

No problem at all. Glad we figured it out! Take care :slight_smile:

1 Like

FYI there was a little more to it. My Hugo template was using whitespace removal:

{{- code here -}}

and this ‘ate’ the newline. In case someone else runs into the same issue.