Catch all route at root of app
Answered
Himalayan posted this in #help-forum
HimalayanOP
Can I have a catch all route page at the root of the app rather than a page?
Option 1
Or option 2
Rather than
Neither option 1 or option 2 seem to work
Even if just defining a page like
Visiting
Option 1
/app
----/[...slug]
----page.tsxOr option 2
/app
----[...page].tsxRather than
/app
----page.tsxNeither option 1 or option 2 seem to work
Even if just defining a page like
const Page = () => {
return <div>page</div>
}
export default PageVisiting
/ will just 404. Unless I use page.tsxAnswered by joulev
option 1 is the way. but
[...slug] matches everything except /. to also match / you need [[...slug]]app/
[[...slug]]/
page.tsx1 Reply
@Himalayan Can I have a catch all route page at the root of the app rather than a page?
Option 1
/app
----/[...slug]
----page.tsx
Or option 2
/app
----[...page].tsx
Rather than
/app
----page.tsx
Neither option 1 or option 2 seem to work
Even if just defining a page like
const Page = () => {
return <div>page</div>
}
export default Page
Visiting `/` will just 404. Unless I use `page.tsx`
option 1 is the way. but
[...slug] matches everything except /. to also match / you need [[...slug]]app/
[[...slug]]/
page.tsxAnswer