refreshing static page goes from 'TestPage' to 'TestPage/' and then trailing slash is removed
Ive been trying to figure this out for couple days, I have no idea what happens, I created new project (completely empty) the issue still remains.
website: https://tinydart.com/TestPage
how to reproduce: going to the page, refreshing, it shows page with slash at the end and then slash gets removed. this messes up google console (causes 'Page Redirect' error) as its a redirect
![No description](https://cdn.answeroverflow.com/1235524262874578954/image.png)
8 Replies
probably your server/platform/... being responsible for the redirect
the same thing happens on my local machine while using wamp and xampp, and with sites that were not made with nuxt3 they do not have this issue
you might want to try out https://github.com/unjs/nitro/pull/1676
GitHub
fix(prerender): allow disabling html sub-folders by danielroe · Pul...
🔗 Linked issue
Related: #1394, #607
❓ Type of change
📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
🐞 Bug fix (a non-breaking change that fixes an issue)
👌 Enhanc...
beyond that, hard to tell without a reproduction
I mean, you can run it without xampp or wamp and just with a node server and see if it still occurs
i managed to "fix" trailing slash with .htaccess, may I ask something off topic ?
my dynamic pages are not working ex: /search/[search] is resulting in "page not found" and when the page is not found my error.vue isnt even shown. If i run "npm run preview" everything works perfectly, but when i "npm run generate" and deploy to host it does not work.
If everything in preview is working ,does it mean its 100% all my servers fault ?
Not exactly
If you generate then you only have static files. Your dynamic pages might not be all generated (“all” = all links nuxt found)
If you need SEO and SSR for these you need a server running and generate is not enough
Otherwise (and you should do that in any case) you can set the error document of your Apache via htaccess to the generated 404.html
So that all pages are rendered by Nuxt, including 404s and non-generated dynamic pages
oh wow, cant thank you enough, in those couple messages you saved my sanity for understanding how its supposed to work, thank you.
no problem!