How can I upload a .well-known folder or a file that starts with a dot?
Depend how you’re building. In most Static Site Generators, you’d have a public
or a static
or a folder that remains unprocessed during build and is copied as is to the root of the website. In that case, you would just create the required files in that folder and build the website. They’ll be available at the desired path.
The thing is, every time I deploy my website, Netlify removes all of the files that start with a dot (.). Which means I can’t add a .well-known folder because it doesn’t upload it
Turns out you’re right. But, it’s only the case with manual deployments (that is deploying from a folder). Deploying from GitHub works fine.
But how do I put my website in GitHub when it has hundreds of files and folders?
As long as it’s not crossing the 2GB limit and no individual file is over 100MB, you can easily do it. If you need more storage, you might want to consider GitLab.
That being said, the how part depends. I’m considering you’ve not installed Git at all. Then, first you’d have to download Git: Git - Downloads and then, you’d have to setup a repo. If you use code editor like Visual Studio Code, it might have an integrated Git workflow and you can use GUI to easily upload files. GitHub also has a desktop app to help you set it up without any commands.
Hy @hrishikesh, I have some issue in continues deployment via git and I have to deploy my site manually. How can I use .dot files to work on my sites. I’m using dot files as email templates.
As he suggested last year in this thread, you should be able to deploy those files from git but not via drag and drop or other manual upload. Do you not see that working when you try? If not, please link us to the deploy in question in our UI so we can see the build logs and try to give you better advice
Hey @fool so I can give you my site id to help? I had the same question. I’m trying to make a folder/directory called .well-known with a filed called discord then some information in it (Im trying to connect my netlify website to my discord.) and netlify doesn’t seem to cooperate with it lol… My website is: apthedev.netlify.app . Let me know if you need more information such as a github page or something!
Note: I’ve been using github to deploy the files for my website.
Thanks,
Aditeya.
Hi, @apthedev. I believe incorrect information was provided here. I believe Netlify always removes and files starting with a .
character when deploying and this includes any directories starting with .
and their contents.
The solution for this is the following steps:
1. deploy the file without the “dot” (do as well-known
instead of .well-known
This step above just deploys the content. However, we still have a problem. At browse time, the site still needs to respond to the request at /.well-known/some-filename-here
. The solution for this is:
2. Create the following redirect rule (this is in _redirects
format):
/.well-known/* /well-known/:splat 200!
This says to proxy the requests for paths under /.well-known/
(which isn’t the name of the directory that was deployed) to the paths under /well-known/
(which is the name of the directory the file was deployed to). The file is now deployed without the .
in the path but it will be sent when a request is made with the .
because of the redirect rule added.
The redirects rule above needs to be in a file named _redirects
(without a file extension - .txt
should not be in the filename). The _redirects
file needs to be placed in the publish directory before the build ends. How that is done varies from framework to framework and, as I don’t know which framework you are using, I cannot say exactly how to do so in this case.
If this doesn’t work as promised, please let us know.