How to upload files to Squarespace root directory
Finding and uploading files to the root directory can be challenging for users of hosted CMS platforms like Squarespace, Shopify, Wix. Unlike traditional web hosting, these platforms don't provide direct access to the root directory. However, some verification methods, such as Google ads.txt, Indexnow.org, and Bing Webmaster Tools, require files to be uploaded to the root directory. This guide will show you how to use 301 redirects to effectively mimic a Squarespace root directory upload.
Why Root Directory Uploads Are Needed
Some services require you to upload files to the root directory for verification or configuration purposes. Examples include:
Google ads.txt: Ensures that your digital ad inventory is only sold through sellers (such as AdSense) who youβve identified as authorized.
Indexnow.org: A protocol developed by search engines to ensure instant indexing, requires a key file to uploaded to root directory for verification.
Bing Webmaster Tools .xml: Verification files to prove ownership of your website.
Understanding the upload on Squarespace
Squarespace doesn't have a traditional root directory structure. This means files you upload through the platform don't reside at the top-level domain. Instead, they are stored as static assets on Squarespace's CDN (Content Delivery Network) and can be accessed via specific URLs.
What root directory uploads look like
When a file is uploaded to the root directory, it is accessible at top-level domain as such yourdomain.com/file.txt
. On Squarespace, achieving this requires a workaround using redirects.
Mimic Squarespace root directory uploads
Step 1: Download the File
First, contact your external service to download the verification file (e.g., ads.txt
, indexnow-key.txt
).
Step 2: Upload the File to Link Manager
Navigate to your Pages in Squarespace dashboard /config/pages
.
Click the Plus icon in the Main Navigation and select Link.
Choose File in the Link Type dropdown and upload
file.txt
using the Link Manager.Exit the Link Editor without saving because we are using the Link Manger as a gateway for file upload only.
After uploading, the key file will be accessible at
/s/file.txt
on your site.
Step 3: Trace the File to Its Source
While the uploaded file is accessible at /s/file.txt
, this path is actually a 302 redirect to its Static URL. Squarespace hosts all uploaded files as static assets on its CDN. You need to trace the file to its source URL to get the real path of the file on the CDN.
Get the real URL of the uploaded file using a URL tracing tool like WhereGoes or Beyondspace Redirection tracer
In the trace URL input, enter your
file.txt
path, e.g., https://yoursite.com/s/file.txt, and click "Trace URL".Once tracking is complete, copy the real URL of the uploaded file.
Image below demonstrate the tracing of a verification key in .txt
Step 4: Create a Redirect in URL Mappings
Create new URL mapping
The redirection will be in this format
/file.txt -> {real-file-path} 301
.
If you used Beyondspace Redirection tracer to trace the redirection, simply copy the redirection in Root Directory Redirection after the trace completed.
Add new redirection in URL Mappings
Go to Settings > Developer Tools > URL Mappings in your Squarespace dashboard.
Insert a new line and place the redirection as new line
Press Save.
Step 5: Proceed with the Verification
Follow the verification steps required by your external service, using the redirected URL.
How This Works
Some services accept redirections. By setting up a redirect, we simulate the presence of the file in the root directory. Google, for example, explicitly states in their documentation that they support redirects for ads.txt
files.
Google documentation on redirects
Google supports a single HTTP redirect to a destination outside the original root domain (e.g., example1.com/ads.txt
redirects to example2.com/ads.txt
). Multiple redirects are also supported as long as each redirect location remains within the original root domain. This is why tracing the source is crucial since the initial upload creates a 302 redirect, and by pointing directly to the CDN source, we create a single redirect.
Supported Services
Not all services support redirections. It's important to verify this on a case-by-case basis. Confirmed supported services include:
By leveraging redirects, we can effectively mimic the Squarespace root directory file upload without relying on external services. This method is also suitable for users on Squarespace's Personal plan.
Frequently asked questions
Question: Where is the root directory in Squarespace?
Squarespace doesnβt operate with a traditional root directory like tradditional hosting. Files uploaded to your Squarespace site are stored as static assets on its Content Delivery Network (CDN) rather than at the top-level domain. These files are accessible through specific URLs, not directly from a root
folder.
Question: How to upload an ads.txt File to Squarespace?
Squarespace does not offer direct access to a root directory, but you can achieve the same functionality by using URL mappings to simulate the placement of an ads.txt
file on root directory
Conclusion
While Squarespace doesn't provide a traditional root directory, you can still meet the requirements of various verification services by using 301 redirects. This approach allows you to maintain your site's performance and security while complying with external service requirements.