I am running college website for over year now. As i main person for documents on website i tried in the past to improve some things.
In our platform we have integrated Google Search(with filetype:pdf set)for browsing thought the docs.
Our college has over 100 computers, and many of them has problem with opening PDF files.
Old links were like this: college.com/Handbook_for.pdf which basically load pdf file.
I have changed with .htaccess, if link is with .pdf to open it in the webpage as pdf preview in one div and it works on all comps.
BUT
Our search internal search (Google) now doesn't recognize it as PDF and it wont show in the search results.
This is how google recognize PDF file
While trying to fix this, i accidentally found this website (spammy one): Which tricks Google to think that his page is PDF file. Google recognize the PDF, even if it's not
So i think i should do something like that.
I have tried with header("Content-type:application/pdf");
but it loads the file again.
Does anyone knows how to "simulate" pdf?
If the primary concern is Google, due to using their search engine, this might be fairly easy. Expose the file to the googlebot as an actual PDF, otherwise display it in your embedded DIV.
if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), "googlebot")) {
// Return actual PDF (with appropriate content headers)
} else {
// Show in div
}
In this way, when it indexes, it will see it as a PDF, but a human opening the page will instead get your embedded version.
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.