How to redirect?


I’m very new to Netlify and kind of a newbie regarding deployment, building, redirecting… So please take that in consideration.

I recently developed a website using Gatsby and deployed it on Netlify (don’t have a custom domain name for the moment but I plan to – just experimenting right now). This website includes a portfolio. I’ve got a portfolio section with project cards and in each card there is a link to the project (<a href=""></a>) in order to try it (for instance a single webpage app).

One of this project was developed using pure Javascript (no React), but as I did not figured out how to render it on my Gatsby website I decided to deploy it from its own github repository on its own domain.

But now I would like to make the link between my main domain (Gatsby website) and this little project hosted on another domain in a proper way. When the user will click on the anchor in the project card, I would like him to be redirected to an URL that looks like so:


Unfortunately I feel clearly overwhelmed and I don’t know where to start to achieve what I want. Does someone can explain me in a very simple way how to proceed?

To help me I already read this:

Hey there!

What you’ll need is a proxy rewrite! So long as both of the sites are within the same Netlify team, you could have a redirect rule such as:

/images/* 200

The rule would live in a file called _redirects in your projectsite (not your maindomain) repo.

This means that any resource under /images/ on your project site (such as will actually serve content from… but in your browser, it will show :+1:!

I hope that this is what you’re looking for!

Hi Pieparker. Thank you for this really fast answer.

I tried what you adviced but still didn’t obtain a satisfying result. I’m not sure I really get what you wrote.

My maindomain right now is a random netlify app name as my project domain (let’s call it projectsite as you wrote) – so two netlify apps at the moment (same team). I plan to add a custom domain name to my maindomain like

So when the user will click on the link in the project card at, he will be redirected on the projectsite, and browser URL will display or

I don’t want the projectsite URL to be displayed in the browser. Instead everything rooted to

So I’m not sure what you wrote is what I want to achieve :


Yep, the above rule will still work. On your site (which is currently only accessible via a domain), you can add this rule:

/projectname/* 200

This will ensure that the projects appear to be served from your domain.

Hello. Sorry I didn’t reply. It seems easy but I didn’t manage to make it work so I got frustrated and felt uncomfortable… I applied what you told me and it did not work. I think I’m not so far to solve the problem though.

Just to be clear, here is my main netlify site (the one I plan to have a custom domain name for):
In there you can find a ‘Projects’ section with a card. When you click on ‘Demo’ you are redirected to

So to have**projects** in the browser url I followed what you told me. I created a _redirects file in the root folder of my main website ( Here is the content:

/projects/* 200

It’s not working but I don’t why… Am I supposed to do anything in the root folder of my little project (like rename something)? Also root folders of main website and little project both live in different repos on Github.

Thanks for clarifying, @artrn! Let’s get things working :slight_smile:

As far as I can tell, you have hardcoded that URL on dreamy-shockely in your html on angry-galileo:

<div class="projects-section-module--l-box--310Vy"><a href="" class="sc-Axmtr iVHkBJ projects-section-module--demo-link--2daB3">Demo</a>

I think what you meant to do is:

  1. configure the proxy redirect you mention:

/projects/* 200
It is not in place on your current deploy of angry-galileo, in case you thought it was.

  1. then edit the source code on your angry-galileo site, to refer to instead of dreamy-shockley, angry-galileo:
  1. but you’ll also need to deploy the angry-galileo site as /projects/index.html instead of /index.html, so that it is where the proxy redirect points - under /projects rather than under / where you have the demo setup today.

@fool Thanks a bunch for replying me. I changed angry-galileo for a registered custom domain name which is now Anyway I guess the same method applies…

  1. Ok - I added that _redirects file in the root of my project with:
    /projects/* 200

  2. Not sure - I’ve got to modify the href of my anchor tag like so? href=''

  3. I guess I’ve got to rename my /index.html as /projects/index.html in my public folder right?