#Redirect to index.html instead of 404 page

1 messages · Page 1 of 1 (latest)

versed arch
#

I trying to build an app that allows the user to go to any slug and it will direct them to the index.astro page (excluding already defined pages such as checkout.astro, etc)

domain.com/slug-1 = index.html
domain.com/slug-2 = index.html
domain.com/slug-3 = index.html
domain.com/checkout = checkout.html
domain.com/slug-4 = index.html

I will use the slug to pull the information from the account so I can brand the app. How do I go about fixing the redirect?

hoary eagle
#

you want a 301 redirect?

versed arch
#

Yes similar to that but I want to preserve the URL

patent dawn
#

Are you using ssr?

versed arch
#

No it's SSG

#

I got the [...slug] working but it only picks up when the variable is in the url. How do I do it so it renders regardless of the slug?

#

In my Firebase.json I have the following:

"rewrites": [
        {
          "source": "/**",
          "destination": "/index.html"
        }
      ]

This allows me to show the homepage on any URL that is not specified. But since I've go Astro it taes control of the routing and shows a 404

boreal sonnet