Incorrect Routing Behavior: Existing Pages Not Accessible, Catch-All Route Takes Precedence
Unanswered
Yaman posted this in #help-forum
YamanOP
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
not to the login page
how to fix this issue?
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 routenot to the login page
how to fix this issue?
2 Replies
YamanOP
I was thinking of
I have my pages->auth->login.tsx
and I have a rewrite like:
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....
rewrites the sources, likeI 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....
here is how my file structure looks like: