First of all, thankyou for anyone who responds for help. It is much much appreciated.
I have been tasked with uploading two xml files into a squarespace site, for use with an app which connects to them both.
The url structure for the file is meant to be: example.com/app/file.xml
Squarespace only allows the following URL: example.com/s/file.xml
The app will only work with: example.com/app/file.xml
Does anyone know how to do this?
There is a potential work around for this. Ensure the name of the file you are uploading has no spaces, capital letters or special characters in it. Then:
/app/myfile.xml -> /s/myfile.xml 301
as a URL Mapping in the text area (where myfile.xml
is the name of your file)You can view a working example here. The temporary, view-only password is: password
. In that example, the file name is note.xml. You would use your own file name.
Important note when testing redirects in Squarespace: Squarespace caches redirects in your browser. So, when testing to see that your redirect is working, make sure to use a Private/Incognito window and close the window between tests. Alternatively, you can continually clear your browser's cache between tests.
If (and only if) you get the above to work on your site similarly to how it works in my example, then test it using your app. If it works in your browser but your app doesn't seem to be able to access the file, ensure that you have a paid site and that your site is not password protected (the app may not be able to get through the password).
If it still does not work, it likely has to do with the Content-Disposition
response header that’s sent with files uploaded via the link editor. Your final alternative is to enable developer mode and add the file to the /assets
folder (then edit the URL mapping accordingly to use /assets
instead of /s
).
If you need dev. mode (and you might not), note that turning on dev. mode isn't recommended unless you understand the ramifications, especially if this is a live site or site you've already spent a lot of time on setting up. Alternatively, you could quickly setup a new demo, turn on dev. mode, and test the solution that way without worrying. Using dev. mode and accessing the /assets folder requires familiarity with Git and other development tools.