我尝试访问我的个人网站上的Resume.pdf文件时出现“页面未找到”错误。

huangapple go评论92阅读模式
英文:

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:

    &lt;li className=&quot;w-[160px] h-[60px] flex justify-between items-center ml-[-100px] hover:ml-[-10px] duration-300 bg-[#565f69]&quot;&gt;
            &lt;a
              className=&quot;flex justify-between items-center w-full text-gray-300&quot;
              href=&#39;../Resume.pdf&#39;
              target=&#39;_blank&#39;
            &gt;
              Resume &lt;BsFillPersonLinesFill size={30} /&gt;
            &lt;/a&gt;
          &lt;/li&gt; 

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=&quot;/Resume.pdf&quot;.

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

huangapple
  • 本文由 发表于 2023年3月7日 20:08:10
  • 转载请务必保留本文链接:https://go.coder-hub.com/75661788.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定