File access in hosted site with custom domain

I have trouble accessing a .rtf file in the www-folder. From this part of the docs, I got the impression that I could serve files too:

( Anything you place in “www” folder can be served as your website, with two exceptions: files that start with an underscore (_) or period (.) are private, and not viewable by visitors.)

And it works. I have a folder ‘files’ and on localhost, I can download the file no problem. Also works. However, I’m using a custom domain and gives a 404 not found error.

Should I be serving this file some other way? This is literally the only file we need to have on the website, but it would feel cleaner to have it in the /files folder than some external system.

@mxr Anything you put in the www folder (and subfolders) should be accessible, however the file name won’t be preserved. Vapid adds a fingerprint to the file name for caching purposes. For example, /files/file.rtf might turn into /files/file-45d7f644c70be76877821e07ed9d09c3.rtf (the fingerprint/hash will depend on the file’s contents). If you’re linking to the file on the website, the link’s href will be rewritten automatically.

If you’re looking to preserve the file name as file.rtf, it might be better to use Dropbox or the like.

Yes, I noticed the fingerprint. The problem is with the version of the site with a custom domain. On the site, when I’ve linked to the file, it works. On the custom domain version, the link points to a link like this, which when opened would give a 404 error. However, now today it works as expected, after I reverted to the exact same situation which didn’t work previously. So maybe it was a temporary thing with the CDN or deploy process?

Anyway, thank you for the quick reply!

1 Like