I want to render netlify site url via subfolder

I have 2 sites hosted via netlify. I want to know how can I apply redirect proxy in such way that when I navigate from site 1 (ex: site1.com/subpath1/subpath2) to another netlify site it renders site2 root but the url is still site1.com/subpath1/subpath2

Im able to achieve the first part via the below redirect rule
[[redirects]]
** from = “/subpath1/subpath2/*”**
** to = “site2.com/:splat”**
** status = 200**
** force = true**

But when any link is clicked from site2 the url changes to site2.com/subpath1 whereas I want the url to change as site1.com/subpath1/subpath2/subpath3

Hey @ansi2u

This is likely due to the <a> elements on the second site. If they are href="/path" instead of href="path" or href="./path" they are relative to the site root rather than the current path/page.

@coelmay : Thank you for your response. I made some edit in my post. I did a mistake in the URL pattern.

Still not clear with the solution you proposed.

Can you provide the site in question?

site1 - https://my-main-site.netlify.app/

site2 - https://my-wp-site.netlify.app/

site 1 has

[[redirects]]
  from = "/dev/stage1/*"
  to = "https://my-wp-site.netlify.app/:splat"
  status = 200
  force = true

What I want to achieve is when I click any link in site2 , it should show https://my-main-site.netlify.app/dev/stage1/{site2link}

Site 2 is using Nuxt, and by default everything runs relative to /. You need to change the router base to run on the path you want it viewed on.

Super valuable input. Thank you very much. This is clear for cases where the site2 is under our control. How do I manage the same in cases where I might not have direct access to site2.

Example if site2 is a wordpress site

Site 2 is using Nuxt, and by default everything runs relative to /. You need to change the router base to run on the path you want it viewed on.

with this the redirection part from site1 works absolutely fine but as a independent site none of links work any more.

You can’t have it both ways. Either it is an independent site, or viewed as a sub-directory.

If the site was a WP site that you controlled, the much the same as Nuxt, set a base path. If it is someone else’s site, don’t proxy to it.