vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
11.48k stars 1.86k forks source link

like `https://foo.github.io/bar/`, The secondary directory of the domain cannot load static files normally. #3729

Closed sun0225SUN closed 1 month ago

sun0225SUN commented 1 month ago

Describe the bug

https://vitepress.dev/reference/site-config#base

In my business scenario, I need to deploy the distribution files to the secondary directory of the domain. But I encountered some problems

Open the domain's secondary directory directly in the browser and it works without any problems.

https://docs.lusun.com/tcq/

image

But when you directly open other sub-links besides the homepage, problems arise. (Open link in new tab)

https://docs.lusun.com/tcq/basic/download.html#download

image

The website cannot load static files normally

Reproduction

Please see the bug description. The project repository is here. https://github.com/yuanze-team/tcq-docs

Expected behavior

Load static resource files normally.

System Info

Failed to load resource: the server responded with a status of 404 (Not Found)

Additional context

none

Validations

sun0225SUN commented 1 month ago

已解决,把静态资源内容放 public 目录下了。 https://vitepress.dev/guide/asset-handling#the-public-directory

image