Why the url is giving 404?
Answered
Ragdoll posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
RagdollOP
I am a noob. I have added two pages about.tsx, posts/[id].tsx, But I see 404 when I go to the urls
http://localhost:3000/about
http://localhost:3000/posts/12
Code: https://gitlab.com/aruprakshit/next-app-router/-/tree/main/app/pages?ref_type=heads
http://localhost:3000/about
http://localhost:3000/posts/12
Code: https://gitlab.com/aruprakshit/next-app-router/-/tree/main/app/pages?ref_type=heads
Answered by Ray
the
the reason why you got 404 is you are using page router inside the app router
pages
folder should be same level as app
folder.the reason why you got 404 is you are using page router inside the app router
20 Replies
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
the
the reason why you got 404 is you are using page router inside the app router
pages
folder should be same level as app
folder.the reason why you got 404 is you are using page router inside the app router
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
RagdollOP
oh I see. I was following github copilot might be read it wrong
btw I am trying to understand the app based routing vs page based routing
the routes I wrote can be written in nextjs using app router without pages router as I wrote>
?
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
yes, try creating a route in
app/about/page.tsx
and app/posts/[id]/page.tsx
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
RagdollOP
Let me do it
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
// app/about/page.tsx
export default function Page() {
return <div>about</div>
}
// app/posts/[id]/page.tsx
export default function Page({ params }: { params: { id: string } }) {
return <div>posts {params.id}</div>
}
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
RagdollOP
@Ray What I need to change in the index.js file as I can't see its content either https://gitlab.com/aruprakshit/next-app-router/-/tree/main/app?ref_type=heads
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
in app router, all page should be named in
page.tsx
so
app/page.tsx
is the index page![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
RagdollOP
ok
so near future page based routing wll be discontinued ?
like why these bi directional architecture?
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
not sure about this
the doc said this
![Image](https://cdn.discordapp.com/attachments/1194136584455458847/1194150699693510766/image.png?ex=65af4e81&is=659cd981&hm=56c7f6cc674444cd818e5c4fa6fc6da56363798d7133179b9f0afe1e129271ac&)
app router is a new version
![Avatar](https://cdn.discordapp.com/embed/avatars/2.png)
RagdollOP
ok
Thank you Ray
![Avatar](https://cdn.discordapp.com/avatars/743561772069421169/3c5d689eee4459a24fc420063411c016.webp?size=256)
Ray
no problem😀