CORS for subdomain

I am beginner to websites and I need your help.

I recently made a site ( and subdomain (
I have separate htdocs for both sites. I wanted to keep all downloadable files (images, published pdfs) in .

If I have all files there then
a href=“” download=“file.pdf”>Link</a
is just opening file.pdf in new tab instead of downloading.

However if i make 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 :slight_smile:


What If I actually do not use InfinityFree for hosting? :grinning:

Well, you must create an .htaccess file to do that. But as BayoDino said, you cannot use it to host files.

Not using a hosting provider is better than using it but breaking its rules.

I do suspect CORS is the issue too. Specifically, I think you’re running into this security system:


Well, if there is not anything I could do, I guess I will follow BayoDino’s advice.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.