content
content copied to clipboard
Accessing index.html causes "Document not found"
Environment
npx nuxi info
------------------------------
- Operating System: `Linux`
- Node Version: `v19.7.0`
- Nuxt Version: `3.2.3`
- Nitro Version: `2.2.3`
- Package Manager: `[email protected]`
- Builder: `vite`
- User Config: `modules`, `content`
- Runtime Modules: `@nuxt/[email protected]`
- Build Modules: `-`
------------------------------
miniserve: a CLI tool to serve files and dirs over HTTP
https://github.com/svenstaro/miniserve
Reproduction
npx nuxi init doc-driven-app -t doc-driven
npm install
npm run generate
miniserve .output/public --index index.html
Open http://localhost:8080/index.html Open http://localhost:8080/about/index.html
Describe the bug

Additional context
The "index.html" page should redirect to the corresponding page without "index.html".
| From | To |
|---|---|
| http://localhost:8080/index.html | http://localhost:8080/ |
| http://localhost:8080/about/index.html | http://localhost:8080/about/ |
Logs
No response
Actually this is intented, you should not access the .html file but directly the / and /about pages.
Actually this is intented, you should not access the
.htmlfile but directly the/and/aboutpages.
Anyway, it's confusing. Static hosts may not have such redirect rules. For example, GitHub Pages serves both "/" and "/index.html" pages.
I suggest adding a default redirect rule for this.
Wondering if this should be handled directly by vue-router though? 🤔
Also, what about the canonical?
Also, what about the canonical?
Canonical links? See https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls#rel-canonical-link-method
I know, what I mean is that your server will have duplicate pages: / and /index.html which is not the best.
Does miniserver have an option to redirect without the index.html ?
I know, what I mean is that your server will have duplicate pages: / and /index.html which is not the best.
What I expect:
| Path | Exists | Display |
|---|---|---|
| / | yes | correct |
| /index.html | yes | redirect to "/" |
Of course, I can work around by manually adding rules to my server, which is ideal.
| Path | Exists | Display |
|---|---|---|
| / | yes | correct |
| /index.html | no |
However, it's not easy when deploying to third-party static hosts like GitHub Pages. Current behavior:
| Path | Exists | Display |
|---|---|---|
| / | yes | correct |
| /index.html | yes | confusing error |
Do you have a demo on GH pages so I can check @Nugine ?
https://github.com/Nugine/nuxt-content-example https://nugine.github.io/nuxt-content-example/index.html https://nugine.github.io/nuxt-content-example/about/index.html
Any updates on this ?
It prevents me from migrating an old static site to nuxt content based project, as I cannot access /index.html anymore after added @nuxt/content into the nuxt project.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.