Redirect path from website to another Netlify site

I have a website on personal-website.com hosted on Netlify at personal-website.netlify.app which points to the git repository github.com/username/personal-website. I have set up the DNS, CNAME and A records so that personal-website.com and personal-website.netlify.app are propoerly in sync. (As you can tell, I’m not familiar with the technically correct parlance).

I have another page (a HTML5 presentation) on github.com/username/presentation which I have deployed on Netlify at persentation.netlify.app. Is there a way I can configure the website such that personal-website.com/presentation opens up presentation.netlify.app?

I am new to Netlify. When I used to host my website on username.github.io, I would simply have a new repository github.com/username/presentation with the relevant HTML files. And, this would be rendered on username.github.io/presentation. I’m trying to replicate this on Netlify.

hiya! seems like maybe what you need is a redirect? :thinking:

Hi Perry, thanks a lot for your answer. I seem to be infinitesimally close to the optimal solution after following the instructions in the resource you shared.

I set up a _redirects file for my static page with the following rule:
https://personal-website.com/presentation/* https://presentation.netlify.app/:splat 200!

I’m having one major issue. When I go to personal-website.com/presentation the fonts from my source css file don’t load in the output html. On the flipside, if I go to presentation.netlify.app directly, the fonts load fine. More weirdly, if I set it up as a 301 redirect instead of a 200 redirect, again, the fonts load fine.

Is there a reason why the 200 rewrite/redirect is messing up my fonts? I would really like to have a 200 redirect (without changing the url) instead of a 301 redirect. Any recommendations on how I can do this?

Okay, I think I have been able to isolate the issue further.

The slides in my presentation go are accessed using the paths /#1, /#2, etc. For example, slide 1 is actually loaded on presentation.netlify.app/#1.

When I setup a 200 redirect, I go from personal-website.com/presentation to presentation.netlify.app … and as a result of this, the slides are loaded on presentation.netlify.app#1 INSTEAD OF presentation.netlify.app/#1 (the last slash is missing). This is why the fonts are getting messed up. Just adding the / in my original URL, i.e., personal-website.com/persentation/#1 is fixing this issue.

Is there any way I can setup the redirect/rewrite rule so that the missing / is included? I have tried several combinations of redirects using splats and placeholders – but to no avail. I think this would solve all my problems. Thanks!

Hey @sidv23, it’s been a while since we checked in with you!

Can you provide me with an example URL for personal-website.com? I want to check what URL we’re working with and how we can make it work in your redirect.

I do believe that we’ve exhibited similar behaviour before and our redirect engine may mishandle fragments (the term for a # in a URL) in redirects. But, we’ll know more with an example personal-website URL :smiley:

Hey @Scott , thanks for checking-in.

personal-website.com = sidvishwanath.com which is hosted on sidv23.netlify.app. And, the website uses Gatsby.JS

personal-website/presentation = sidvishwanath.com/smac-2020, which should ideally redirect to sidv23-smac2020.netlify.app/.

I hope that helps. :slight_smile:

P.S. In the meantime, I have also tried fixing this using the gatsby-plugin-force-trailing-slashes plugin. But, that didn’t help.

Hey @sidv23,

Maybe I wasn’t clear – can you provide me the path on your personal website which you’re trying to redirect, i.e. sidvishwanath.com/presentation/#1 ?

Hey @Scott,

Sorry, I don’t think I understood your question properly the first time around.

I’m trying to redirect, for example, sidvishwanath.com/sep7#1 to sidv23-sep7-2020.netlify.app/#1.

Does that answer your question? (Sorry, I’m new to this :grimacing: )

Thanks for that!

I’m not sure if this will work but it might be worth a try:

/* https://sidvishwanath.com/sep7:splat 200