301 redirect to a proxy 200 redirect

Hello,

I have two separate netlify sites:

- 1 for my main website (prettybar.co > prettybar.netlify.com)
- 1 for the blog (prettybar.co/blog > prettybar-blog.netlify.com)

My redirects for the sites are:

- prettybar.netlify.com:
https://prettybar.netlify.com/* https://www.prettybar.co/:splat 301! /blog/* https://prettybar-blog.netlify.com/:splat 200

- prettybar-blog.netlify.com:
https://blog.prettybar.co/* https://www.prettybar.co/blog/:splat 301!

Problem:

My problem is that I don’t know how to redirect the domain prettybar-blog.netlify.com to prettybar.co/blog since prettybar.co/blog has a 200 redirect (proxy) to the other netlify sites prettybar-blog.netlify.com

So if I add a 301 redirect from prettybar-blog.netlify.com to prettybar.co/blog, I have a “too many redirects” error.

I would like to do that to avoid a duplicate content from Google (+ assets are not found with this url)

How can I do that? Thank you

Hey, welcome to the forum :slight_smile:

It looks like you have one domain name, prettybar.co, and then you want two subdomains of that:

  • www.prettybar.co with the main site, and if users go to /blog/, you want to preserve this URL while pulling blog posts from your other site
  • blog.prettybar.co with the blog

Is that right? Your setup and _redirects on prettybar.netlify.com seem reasonable to me. One thing that might work is creating a domain alias for prettybar-blog.netlify.com by going to Domain Management > Custom Domains > Add Domain Alias and putting blog.prettybar.co there. More on domain aliases here:
https://docs.netlify.com/domains-https/custom-domains/multiple-domains/#domain-aliases

Then, I think you’re _redirects file for prettybar-blog.netlify.com would look like:

/*  https://www.prettybar.co/blog/:splat 301!

Want to give that a shot? If you keep getting that error, come back and let us know so we can dig in a bit more.

One more resource for you that may be worth checking out!