#Astro site with specific SPA section

8 messages · Page 1 of 1 (latest)

hollow bane
#

Hi, is there any way in the dev environment for Astro to redirect all pages within a subfolder to it's index eg mysite.com/spa/1234 -> mysite.com/spa/. So far I can only see that you have to specify the subfolder names using getStaticPaths but you need to know the path names up front.

This isn't an issue in production as the server will handle the redirects, just looking for a convenient way for this to work during dev.

hollow bane
fallow sluice
#

Have you considered redirects? https://docs.astro.build/en/guides/routing/#redirects

I'm not sure if they support redirecting all roles from inside a subfolder to its index because the docs say that dynamic routes need the same parameters but maybe you can try 🤔

Docs

An intro to routing with Astro.

hollow bane
hollow bane
fallow sluice
hollow bane
tacit hollow
#

You can inject Middleware using an Integration, which itself can check if you're in development mode