英文:
I get a Page not found error when i try to access my Resume.pdf file on my personal website
问题
I am hosting my website on Netlify and when I try to open my Resume.pdf it gives me a 'Page not Found' error, meanwhile when the website is hosted locally the pdf file opens without any issues, the code in which the href to the pdf is located is in the src/components/Navbar.jsx and that part of the code looks like this:
<li className="w-[160px] h-[60px] flex justify-between items-center ml-[-100px] hover:ml-[-10px] duration-300 bg-[#565f69]">
<a
className="flex justify-between items-center w-full text-gray-300"
href='../Resume.pdf'
target='_blank'
>
Resume <BsFillPersonLinesFill size={30} />
</a>
</li>
I tried looking at the docs on the Netlify troubleshooting section and i found something about the _recconect
file but since it's a document and not a separate page on my website it shouldn't need to be included, but i tried that too just in case and of course it did not work. I also tried moving the index.html
file along with the Resume.pdf
into the public folder but later i found that since i created my website with Vite the index.html
cannot be placed in any subfolder and must be in the root directory, so that doesn't seem to be the cause of the problem too. The only thing i see that can be the solution for now is to modify that _redirects
file, since i see some similar posts regarding similar issues, but regardless i don't know what should go inside that file in this case if not /Resume.pdf /Resume.pdf 200
, which i have already tried, and the /* /index.html 200
which i have also tried.
英文:
I am hosting my website on Netlify and when I try to open my Resume.pdf it gives me a 'Page not Found' error, meanwhile when the website is hosted locally the pdf file opens without any issues, the code in which the href to the pdf is located is in the src/components/Navbar.jsx and that part of the code looks like this:
<li className="w-[160px] h-[60px] flex justify-between items-center ml-[-100px] hover:ml-[-10px] duration-300 bg-[#565f69]">
<a
className="flex justify-between items-center w-full text-gray-300"
href='../Resume.pdf'
target='_blank'
>
Resume <BsFillPersonLinesFill size={30} />
</a>
</li>
I tried looking at the docs on the Netlify troubleshooting section and i found something about the _recconect file but since it's a document and not a seperate page on my website it shouldn't need to be included, but i tried that too just in case and of course it did not work. I also tried moving the index.html file along with the Resume.pdf into the public folder but later i found that since i created my website with Vite the index.html cannot be placed in any subfolder and must be in the root directory, so that doesn't seem to be the cause of the problem too. The only thing i see that can be the solution for now is to modify that _redirects file, since i see some similar posts regarding similar issues, but regardless i don't know what should go inside that file in this case if not /Resume.pdf /Resume.pdf 200
, which i have already tried, and the /* /index.html 200
which i have also tried.
答案1
得分: 0
Resume.pdf
文件应该位于 public
文件夹中,链接应该是 href="/Resume.pdf"
。
public
文件夹中的文件会直接复制到您网站的根目录中,不会经过任何处理。请查看:https://vitejs.dev/guide/assets.html#the-public-directory
英文:
The Resume.pdf
file should be in the public
folder and the link should be href="/Resume.pdf"
.
Files in the public
folder are directly copied without any processing into your site's root directory. Check out: https://vitejs.dev/guide/assets.html#the-public-directory
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论