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

Netlify site name: wildtechgarden.netlify.app
Custom DNS names: www.wildtechgarden.ca, www.thewildtechgarden.ca and the apex versions of these, and the .com versions of all those.

I discovered that if my _redirects had

www.thewildtechgarden.com (rule: https://www.thewildtechgarden.com/* https://www.wildtechgarden.ca/:splat 301!) after wildtechgarden.com, which was after the .ca versions of those domains, that the www.thewildtechgarden.com 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: https://app.netlify.com/sites/wildtechgarden/deploys/64054132bac83b0008a0a42a

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:

https://www.thewildtechgarden.com/ https://www.wildtechgarden.ca/ 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.

Doh!

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.