I just started using Next JS, following Brad Traversy's tutorial on youtube. I used next export to export the program, just like he did in his tutorial. I used serve -s out -p 8000. The page loads on localhost:8000, however when I go to other links like localhost:8000/about, it just reloads the home page.
I looked for solutions online, I tried adding "trailingSlash": true to my next.config.js file, and it still doesn't work.
And the most confusing part is when clicked on a Link element (from the "next/link" module) on the page, it works, and it takes me to the correct page. But when I want to access it directly from the address bar it doesn't work.
Btw it also works during production.
Edit
Here is the next.config.js file:
module.exports = {
trailingSlash: true,
};
Here is the package.json file:
{
"name": "next-cc",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"export": "next build && next export"
},
"dependencies": {
"next": "10.1.3",
"react": "17.0.2",
"react-dom": "17.0.2"
}
}
Edit: Here is the folder structure
Here is a link to the project
