Wildcard subdomains & redirects


I’ve got a site I’d like to move to netlify that does multi-tenancy based on the subdomain. Because of that, I’d like to know:

  1. Is it possible to set up *.my-site.com as the custom domain for a site?

  2. Is it possible to set up a redirect rule like the following that will preserve the original subdomain:

/api/*    https://*.my-site-api.com/api/*     200

~ Dallin

Dynamic subdomain pointing to same deployment?
Wildcard redirect for domain aliases

Hi Dallin!

Number one is possible; it is a feature available for sites on the Pro plan (see https://www.netlify.com/pricing#teams), and our Support team must explicitly enable it on your site. There are some conditions, but that is the starting point. I’ll be happy to go into details if the price point and my next answer aren’t a deal breaker.

Number two is only possible when rewriting to the same hostname that we host. For instance:

yourclient.yourcompanysitehostedonnetlify.com/api/* could rewrite to yourclient.yourcompanysitehostedonnetlify.com/otherpath/*…but not to yourclient.asitehostedelsewhere.com/anything . The hostname is not available as a “parameter” in the redirect in any way.