I recently made a site (example.com) and subdomain (sub.example.com).
I have separate htdocs for both sites. I wanted to keep all downloadable files (images, published pdfs) in example.com/files .
If I have all files there then
a href=“https://example.com/files/file.pdf” download=“file.pdf”>Link</a
is just opening file.pdf in new tab instead of downloading.
However if i make sub.example.com/files and set link:
a href=“files/file.pdf” download=“file.pdf”>Link</a
then it will download the file.
I know this have something to do with CORS(Cross-Origin Resource Sharing) but I can not find something resolving my issue. Is this possible to do?
Put your downloadable files in a file sharing host and link them back?
This host hosts websites only, and hosting files here and making them available to download isn’t allowed. You should host your downloadable files on file sharing hosts or sites