Subdirectory redirect

Hello !
I’m having troubles with the publishing of my 2 sites.
My git repo is made like this :
/success-app-angular which contains the angular app
/site which contains a website, the files are inside a “frontend” folder
i have got two sites hosted separatly with netlify, app.success-app.fr, running the angular app, and success-app.fr running the site.
But i have an issue, how to redirect ?
I tried to set a netlify.toml inside site and success-app-angular folder :
image
But in vain.
How can i set a netlify.toml for the site and the angular app, to set up the redirects (404) ?
Thanks !

Hey @theophilejr

The redirect in the screenshot won’t work. It is redirect everything back to the domain root.

The title says you are wanting to redirect a subdirectory, but I unsure after reading your post what path you are wanting to redirect, and from where to where.

Can you explain what you are wanting to redirect?

Hey,
i have a github directory with the following structure :
site/frontend → my website success-app.fr
success-app-angular → the web app app.success-app.fr
They two have their own netlify static hosting (one running the site’s folder, the other building angular and deploying the “dist” one).
My goal is to manage the 404 errors (for example if you go on success-app.fr/donotexist it just shows netlify’s 404 page).
so how to set up the redirects for both app.success-app.fr and success-app.fr, which are contained in differents folders, and hosted on differents netlify static websites.
Many Thanks
image
so globally, just wanna handle 404 redirections for both hosting

Thanks @theophilejr

For the main site

If you have a 404.html at the root of the site, and page/path that is not found should (does for me) show this page (e.g. /non-existent-page.html or /actual-path/but-non-existent-page.)

Also check out the Custom 404 page handling documentation if you have more specific requirements.

For the app site

Angular I know next to nothing about, but check out the Angular on Netlify documentation, specifically the redirects section. If you are generating static pages, then having a 404.html may also work. However if you are using routing, you will need to handle 404s internally as you will need the redirect (as in the docs) to ensure the app works correctly.
Check out this article which covers this topic.

1 Like