Support Forums

CNAME redirect to a landing page

Hi all,

I’m just wondering if this is possible with Netlify DNS and my nextJs project.

I want to set up

123.abc.com redirect to abc.com/property/123
456.abc.com redirect to abc.com/property/456

Also is the address bar showing 123.abc.com and users can continue going to other url like 123.abc.com/test will go to abc.com/property/123/test

I notice this is possible with lots of big companies product like Zendesk, Announcekit etc. Not sure how it’s achieved?

Thank you!

Hi @Rico_Chen

I believe you are looking to use a wildcard domain (e.g. *.example.com) that would then write the * to a path of example.com using regex. To the best of my knowledge this is not a feature available on Netlify (though for enterprise customers, who knows.)

As for showing 123.abc.com in the address bar while abc.com/property/123 is the page the user is on, I believe you are referring to URL cloaking/masking which is different to rewriting as outlined above.

Thank you @coelmay

It’s definitely helpful to know the name of this feature: wildcard domain. I did some search and it seems netlify can do it for Pro or higher account.

See their staff’s reply in this thread:

With URL cloaking, do you know more about this? Is it something I need to set up on Netlify or in my actual application?

I know that it is generally advised against. Search “URL Cloaking” in and you will likely find the top result(s) advise against it (and I would advise against it for the same reasons.)

I do not know what Netlify’s status is regarding out-of-the-box support for this.


Wildcard is only needed when you want literally anything to be acceptable. For example, instead of just 123 and 456, you could also use 789, without any extra configuration. However, if you have a fixed (and small) number to setup, it’s better to not use wildcards.

What you want to do is possible, you can add redirect rules like:

https://123.abc.com/* https://www.abc.com/property/123/:splat 200!
https://456.abc.com/* https://www.abc.com/property/456/:splat 200!

This would go in _redirects file. If you need to generate a lot of redirects, you could generate a template logic to generate a _redirects file during build. For example, using JavaScript, you could generate it something like:

const subdomains = ['123', '456']

subdomains.forEach(subdomain => {
  console.log('https://' + subdomain + '.abc.com/* https://www.abc.com/property/' + subdomain + '/:splat 200!')
1 Like