Secondary domain rewrite to specific site page

Hi,
I have two domains pointing to the same site. I would like to use the secondary domain to display a single (sub)page of the website as root. I tried to do a domain rewrite from the secondary domain to the primary domain’s subpage, but I can’t seem to make it work.

What I want is to have:
seconday-domain.com
display:
primary-domain.com/subpage
(both domains point to the same site via DNS)

Right now the secondary domain simply displays the site (same as primary)

Hey @nekdolan

Did you try a rewrite like:

https://www.seconary-domain.com    /path/to/sub-page    200!

or in netlify.toml syntax

[[redirects]]
  from = "https://www.seconary-domain.com"
  to   = "/path/to/sub-page"
  status = 200
  force = true

This is untested and comes with no guarantee that it can or will work.

Even if this did work, links on that page to other pages of the site would break unless they contained the primary domain: e.g. <a href="https://www.primary-domain/a-page">...</a>.

The best option is likely to redirect the secondary domain to the page (which would change the address displayed) using a 302 or 301 redirect rather that rewriting the secondary domain to display a page from the primary domain e.g.

https://www.seconary-domain.com    /path/to/sub-page    301!

or in netlify.toml syntax

[[redirects]]
  from = "https://www.seconary-domain.com"
  to   = "/path/to/sub-page"
  status = 301
  force = true