Back to results for “Layouts”
Next.js › Routing (App/Pages Router)

How is routing in the Pages Router different from the App Router?

Beginner

Answer

In the Pages Router, each file directly inside the pages folder becomes a route based on its file name, such as pages/about.js becoming the about page, while the App Router instead uses folders with a page.js file inside each one, giving more flexibility for organizing related files like layouts and loading states alongside each route.
// Pages Router
// pages/about.js is accessible at /about

// App Router
// app/about/page.js is accessible at /about
Real-world example A developer familiar with the older Pages Router notices that the App Router requires an extra folder level for each route, but appreciates being able to colocate loading and error files right next to each page.

Common follow-ups: Which router should be used for new Next.js projects starting today?;Can a single project use both routers at the same time during migration?