Wildcard redirect for domain aliases

I have a site with multiple domain aliases. With most of the aliases I would like to just redirect users to some other site. I can write a rule for every alias, but it would be nice to just have:

https://sub1.mydomain.com/*  some-local-content-from-that-site
https://*.mydomain.com/*     https://someother.example.com/:splat 301!
  1. How can I “stop redirect processing” for sub1 to serve local content from Netlify?
  2. Should the second construction with * work for other subdomains? From Wildcard subdomains & redirects I know that a host name is not available as a parameter, but I don’t need it.

Howdy!

  1. (I’m answering #2 first because the answer to #1 depends on it :)) We don’t have any plans at present to support the * format in the hostname portion of hostname-based redirects. You can only have 100 names per site so I guess you’d need 99 redirects like that at most.
  2. Since you have to make individual hostname redirects, that shouldn’t be an issue. In general you can’t “short circuit” your redirects - our system will faithfully march all the way down the file to handle things like this:
https://subdomain.domain.com/* https://www.domain.com/:splat 301!
/* /index.html 200!

But since you have to name each host individually, unless you have a SECOND redirect from the subdomain to ANOTHER domain, no other redirects will trigger (except the ones in the style of the second one in my example, which you’d need if you have an SPA).

2 Likes

Thanks for your answer. I have “just” several aliases and currently have 2x several entries (no strict HTTPS enabled yet). As they don’t change to often it’s not a big problem to manage it in that way and in addition probably just a fraction of Netlify users encourage that situation.

1 Like