Closed li-jinbao closed 2 months ago
You haven't set cleanUrls: true
in your config. https://vitepress.dev/guide/routing#generating-clean-url
The problem has been solved. It was an issue with the Nginx configuration.
try_files $uri $uri/ /$uri.html /index.html;
Describe the bug
When I access URLs like /xx, the homepage always appears, which obviously should not happen. However, if I access URLs like /xx.html, the page renders normally. Currently, my project is deployed on Tencent Cloud. The problem does not occur in the development environment, but only after the production deployment, when domain name resolution and Nginx forwarding are involved. Besides,if i click button to some url,it will show correctly . Only when I directly access the URL in the browser, the page rendering error occurs.
Reproduction
git clone https://gitee.com/CrazyClue/vitepress.git use npm install & npm run build nginx:
Expected behavior
My website can show correctly when i access url directly in the browser without “.html” .
System Info
Additional context
No response
Validations