August 28, 2024 at 11:35 am | Design, Programming, web.

Certain processes have you create a .well-known folder and file inside at the root of your site. These can be anything from security protocols to verification services. This can be a problem with hosting services that do not allow the creation of the folder or that have site media stored at another URL location such as a subfolder or alternate subdomain.

Here is a quick tip on how to create a file like this inside of a hosting service like Hubspot.

File upload

The first thing you will need to do is download whatever file you want to serve at a specific .well-known location. Once you have the file, add .txt extension if it doesn’t have an extension. If it already has an extension like .json leave it alone.

Take the file and add it to your site media at: Library -> Files

Once you have uploaded the file, click on the file details. Click on “Copy URL”. The file will usually contain a Hubspot host name so switch that out for your domain. These URLS will both resolve, but we want the one with our domain for the next part.

https://12341234.fs1.hubspotusercontent-na1.net/hubfs/12341234/NAME-OF-FILE.txt

would then be

https://www.YOUR-DOMAIN-NAME.com/hubfs/12341234/NAME-OF-FILE.txt

Proxy redirect

What we want to do now is create a redirect in Hubspot that links the URL that we want this file to resolve at.

Under: Prefernces -> Tools -> Content -> Domains & URLs, click on the URL Redirects tab and then “Add URL Redirect”.

Under Original URL we will put the .well-known URL address. So something like: https://www.YOUR-DOMAIN-NAME.com/.well-known/service/NAME-OF-FILE

Under Redirect to, we will put the updated file location with our domain added from above. So, https://www.YOUR-DOMAIN-NAME.com/hubfs/12341234/NAME-OF-FILE.txt

Open “More Options” in the redirect and make sure that you choose: “Proxy” from the list.

Link to Hubspot support ticket with photos for reference