问题
is it possible to redirect a link to a pdf file?
This is my site: www.mysite.com
And I createad a redirect link that if I open www.mysite.com/documentation - an index.html file will open but for now this index.html file says it's under construction.
Can I redirect the link to a pdf file? I uploaded the pdf file into the server. So that if I open www.mysite.com/documentation, my pdf named as thedocument.pdf will open.
Is it possible?
回答1:
If your web hosting provider won't allow you alter the default extensions (i.e. to add pdf) then you could create a HTML page to act as the landing page and then redirect to the PDF.
Details here: http://www.web-source.net/html_redirect.htm
回答2:
Yes, this is possible. Check your web server configuration that currently points /documentation to index.html, and change it to point to thedocument.pdf.
Be aware that the PDF may or may not load in the user's browser. Some configurations will prompt the user to download the file.
回答3:
You can achieve this with a modX Weblink.
- Upload your pdf to a place from where it is publicly downloadable. For this example I will upload it to
modx/assets/content/test.pdf
. You should now be able to download your file fromhttp://yourdomain.tld/assets/content/test.pdf
. - Create a new weblink resource in modX (Site -> New Weblink) on the base level of your resource-tree. Make it a container and type in 'documentation' as the alias of your resource. You should also make sure, that you already use friendly urls, but your question sounds like you're already doing this.
- A weblink has a field to enter the 'weblink' instead of the ressource content. Just use the URL from which you are already able to download your pdf-file. In this example, this would be
http://yourdomain.tld/assets/content/test.pdf
. - If you now view the newly created weblink resource under
http://yourdomain.tld/documentation
, you should instantly download a copy of your file test.pdf.
来源:https://stackoverflow.com/questions/8726708/is-it-possible-to-redirect-a-link-to-a-pdf-file