Mask a subdomain under 'www'

Hi fellas,
I have two subdomains (www, app) which I’d like to host under the same subdomain (www).
To make it clearer - I’d like the url https://app.gettacar.com/search* to be accessible from https://**www**.gettacar.com/search*.
These are actually two different servers, each has it’s own DNS settings but I’d like it to be transparent to our visitors (and SEO bots & spiders).

How would you recommend doing this?

Thanks, Asaf

Hmm, if I’m understanding you correctly, you’d like all the typical content from the www server to be served if requested on the www subdomain, but you’d also like content that’s on the app server only, to be returned from a request of it against the www subdomain (where that content doesn’t exist on the www subdomain)?

If so, you’d need to overload your 404 page on the www subdomain to check if the requested content exists on the app subdomain, and if it does decide if you just want to redirect to the app subdomain, or have the server make the request of app and return the results of it via the originating www request.

Thank you Sandro and benhelps for your replies.
Just to clarify - I have two apps, one is hosted under ‘www’ and one under ‘app’ subdomains.
My goal is to leave it as two apps serving content but eliminating the ‘app’ subdomain in the browser’s url. I’m looking for a DNS solution to tell specific urls to serve content from the ‘app’ server, hence serving content from https://app.gettacar.com/search as https://www.gettacar.com/search in the url address line.
Thanks!

You said “transparently”, that would require a redirect and be the opposite of what you asked now for.

So, intransparently then? You want to serve the “app” content under “www”? For starters, that cant be really done using DNS, respectively you wouldnt serve “/search” only but the whole site. Is that what you want? If not, you could only deploy a worker on “www”, which you map to “/search” and which then handles requests and forwards them internally to “app”.

Apologize, I’m not sure what the exact terminology would be here :slight_smile:

Bottom line - I have a legacy site and a new one and would like both to be served under ‘www’.
I’m in the process of migrating from one to the other but can’t do it all at once. One area at a time…

You cant serve two sites under the same record.

Can you provide actual example URLs and where they should point to, respectively what they should do?

Sure.
If you take a look at my Home Page - https://www.gettacar.com/ (legacy server), use the Menu navigation and select ‘Buy a great car’ you will be sent to https://app.gettacar.com/search (new server).

Ideally I’d like all urls to have the ‘www’ subdomain.

Thank you Sandro :slight_smile:

That is something you will have to change on the site. You need to change the links from “app” to “www”.

:wave: @asaf.abady,

What you are looking to do probably requires using workers. Check out the workers template gallery I believe there is a router example which may apply.

— OG