#Incorrect Routing Behavior: Existing Pages Not Accessible, Catch-All Route Takes Precedence

3 messages · Page 1 of 1 (latest)

onyx pumice
#

I am on Pages route, and I have a catch-all route to catch the page slug and fetch if from the db
but when I write a name of an already exiting page for example: login
it takes me to the the catch-all route not to the page it self
how to fix this issue and make my app to check if the slug has a file with the same name that means I need this file otherwise render the slug route?
here is how my project files:
pages:
-->cart:
-----> checkout.tsx
-----> [...slug].tsx
-----> login.tsx
-----> register.tsx
when I want to go the login page:
url.com/login
it takes me to the [...slug].tsx route
not to the login page
how to fix this issue?

kind zealotBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

onyx pumice
#

I was thinking of rewrites the sources, like
I have my pages->auth->login.tsx
and I have a rewrite like:

{
 source: "/login",
 destination: "/auth/login"
}

but I feel it does not make sense because I have to do it for all my routes that do not have any prefixes like: cart, checkout etc....