Redirect rule to forward traffic to same suffix instead of redirection

hi, my blog and doc section of my website is hosted on netlify with netlify subdomain as " reliable-buttercream-0e11cf.netlify.app" and primary domain in netlify is blog.coderabbit.ai. There is no redirect file or netlify.toml file configured. My main website is hosted in flamer and all routes is taking place from flamer for now. I am trying toml file as below for redirect rule.
“[[redirects]]
from = “/”
to = “https://abc.com/blog/
force = true”
What I am trying to achieve here is. If someone hits abc.com/blog then it should open the page published on netlify. RIght now if I hit my domain as coderabbit.ai/blog, it gets redirected to blog.coderabbit.ai which I didn’t want. I wanted it to keep in same suffix instead of redirecting something like nginx proxy works.
Expected output: If someone hits coderabbit.ai/blog, it should provide netlify page on same domain with suffix instead of redirecting it to blog.coderabbit.ai.

@dikshant I’ve read your explanation several times and am thoroughly confused about where the various pieces are hosted and what the placeholder “abc.com” represents.

Can you perhaps list the various elements and where they’re hosted?, and then try again to explain which specific one you’re trying to redirect/rewrite/proxy to where?

Hi @nathanmartin ,
Thanks for responding. abc.com here represents the main website i.e. coderabbit.ai.
My main website is coderabbit.ai which is hosted on framer. Routes in framer are in such a way that /blog it redirect to blog.coderabbit.ai and /docs to docs.coderabbit.ai .
I have my blog and doc website hosted with blog.coderabbit.ai and docs.coderabbit.ai.
I wanted to configure them in such a way that for blog and doc, it should be accessible at coderabbit.ai/blog and coderabbit.ai/docs.
I tried two fixes.
Fix 1: I configured netlify.toml file attached below but both doc and blog suffix is getting redirected to blog.coderabbit.ai

[[redirects]]
  from = "/"
  to = "https://coderabbit.ai/blog/"
  force = true

[[redirects]]
  from = "/"
  to = "https://coderabbit.ai/docs/"
  force = true

Fix 2: I configured below netlify.toml file. For docs, its getting redirected to doc.coderabbit.ai and for blog, it throws error as too many redirects. I got the similar error when I tried to achieve this directly in cloudfare by routing.

[[redirects]]
  from = "/docs/"
  to = "https://coderabbit.ai/docs/"
  force = true

[[redirects]]
  from = "/blog/"
  to = "https://coderabbit.ai/blog/"
  force = true```

I hope this gives you a clear problem statement.

@dikshant I’m perhaps still not quite understanding, but it sounds like you’ve got it backwards which is not something you can do from Netlify’s side.

You want:

coderabbit.ai/blog (a URL hosted on framer)
to proxy to https://reliable-buttercream-0e11cf.netlify.app/blog/ (a URL hosted on Netlify)

coderabbit.ai/docs (a URL hosted on framer)
to proxy to https://reliable-buttercream-0e11cf.netlify.app/ (a URL hosted on Netlify)

You’re trying to show a Netlify URL when someone is on a Framer URL, this is something that Framer would need to be capable of.

In terms of the site ending up at the subdomains, one reason that occurs is that your links point there, which is why you end up there even when on the .netlify.app URL.

image

Note that when you want to proxy and not redirect you also have to use a status of 200, it won’t fix what you’ve got, but may be worth knowing for future reference:
https://docs.netlify.com/routing/redirects/rewrites-proxies/#proxy-to-another-service

If the entire situation was reversed, where the main site was on Netlify and the sub-sites were either on Netlify or elsewhere, it would be possible, and you’d achieve it with rules like:

[[redirects]]
  from = "/docs/*"
  to = "https://some-other-site.com"
  force = true
  status = 200

hi @nathanmartin , thanks for the response and the way you described it. I was hoping the same thing as you described because the main website is hosted on framer. Can we achieve this with framer by changing the CSS code somehow or I removed the suffix from Framer and try to redirect from netlify?

I can’t provide answers for what you can/can’t do with Framer.

You might want to try Framer’s support:
https://www.framer.com/contact/

Specifically they appear to have a ‘community’ here:
https://www.framer.community/c/developers/

hi @nathanmartin , thanks for response. I am connecting with them. I am bit new in CSS so just wondering how should I restructure my CSS code in terms of subdomain because I believe if I try to host my domain in netlify, it could cause some issue.

@dikshant I can’t say, I’ve just given you quick answers to help you keep going, any issues you have with your project are ultimately for you to learn about and solve.

This forum is for assistance with Netlify’s products, not more general web development assistance.