Trying to have a link open up to a PDF. I have the href="filename.pdf" - the pdf file is in the same folder as the html file. When I click on the link it opens to a new page (I have it set to open a new page) which says "Cannot GET /filename.pdf". I open the console and it says "Failed to load resource: the server responded with a status of 404 (Not Found)".
I found a solution that works but I don't understand why: This doesn't work:
<a target="_blank" class="cta-btn cta-btn--resume" href="connerschiller.pdf">View Resume</a>
But this does work:
<a target="_blank" class="cta-btn cta-btn--resume" href="../src/connerschiller.pdf">View Resume</a>
The html file is in the src folder as well.
Ok so the fix I listed above is working when I run it locally, but when I try to open the PDF link on the deployed site on netlify it says "Page Not Found Looks like you've followed a broken link or entered a URL that doesn't exist on this site."
If the file is in the same directory you need to use as follows:
<a href="./filename.pdf">My pdf</a>
the./ is to especify the same directory
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.