How to host a Squarespace export on Nginx
To host a Squarespace export on Nginx, copy the unzipped folder to your web root, add a server block with try_files, and use a single rewrite rule with a regular expression for dated blog URLs. Squarespace has no code export, so the copy is a saved render. Replace its form and store blocks.
Last reviewed
Key facts
- One rewrite with the permanent flag can map every dated blog URL to a short one.
- A regular expression containing braces must be wrapped in quotes in an Nginx config.
- Squarespace’s own export is an XML file meant for WordPress.
- Nginx cannot process Squarespace form blocks, so each needs a new endpoint.
What a Squarespace export brings to Nginx
WebExport saves the Squarespace page hierarchy, template styles, gallery scripts and images from the public site. Nginx serves them as files. A small business site can sit on a single virtual server, and the first deploy takes a few minutes once the server block is in place.
The redirect work on Squarespace blogs fits Nginx well. Where other hosts need a placeholder syntax of their own, Nginx lets you write the pattern as a regular expression and reuse the slug in the destination, so one line covers every dated post.
Copy the files and add a server block
- Copy the unzipped folder to the web root on your server, for example /var/www/exported-site.
- Add a server block that points root at that folder and lists index.html as the index file.
- Check the syntax, then reload Nginx without dropping connections.
- Request a certificate for the domain once DNS points at the server.
rsync -av --delete exported-site/ user@server:/var/www/exported-site/
sudo nginx -t && sudo systemctl reload nginxRedirects, headers and 404s on Nginx
Nginx keeps everything in its own config files. Use return 301 for a single move and a map block for a table of old and new paths. error_page 404 /404.html picks the not-found file, and try_files decides how URLs map to files. An add_header directive set inside a location block replaces the ones inherited from the server level, so repeat the headers you still want there. Nginx ignores .htaccess files, which only Apache reads.
This server block redirects dated blog posts and an old journal folder, then serves the rest as clean URLs.
server {
listen 80;
server_name example.com;
root /var/www/exported-site;
index index.html;
rewrite "^/blog/\d{4}/\d{1,2}/\d{1,2}/(.+)$" /blog/$1 permanent;
rewrite ^/journal/(.*)$ /blog/$1 permanent;
error_page 404 /404.html;
location / {
try_files $uri $uri.html $uri/ =404;
}
}The quotes around the first pattern are required because it contains braces. Open three real post URLs from your sitemap and check that the pattern matches them before you rely on it. permanent returns a 301 and redirect returns a 302. Rewrite rules at the server level run before location blocks.
Squarespace output that needs fixing on Nginx
| In the Squarespace output | What to do on any static host |
|---|---|
| Images from squarespace-cdn.com and static1.squarespace.com | Open a page offline and watch the network tab. Any request to those hosts means a path was missed. |
| Features that fetch data from the live site | Load-more buttons, search and some blog listings ask the Squarespace server for data. Test each one on the static copy. |
| Form, newsletter and commerce blocks | These post to Squarespace. Replace the form targets and send shoppers to a hosted checkout. |
| Blog category and tag views | They are generated on request. Only URLs that appear in the sitemap or in page links are saved. |
Replace Squarespace form, newsletter and store blocks, because each posts to Squarespace. Test load-more buttons and search with the network tab open, since some of them call the live site for data. Category and tag views are generated on request and are only saved if the crawler found links to them, so check your blog index.
Forms and dynamic features
Nginx can proxy a POST to another service with proxy_pass but cannot process a form itself. Send the form to a form service or to an app you run on the same server.
A single location with proxy_pass can send a form to a service or to a small app you run beside Nginx. For a newsletter, use your email provider’s embed form instead.
What can go wrong
- A pattern that matches too much can redirect real pages. Test it with curl -I on a few URLs.
- Leaving both the dated and short URL live splits link signals. The 301 fixes it, so confirm it fires.
- A server with no certificate shows browser warnings. Request one before you move the domain.
Frequently asked questions
How do I redirect dated Squarespace blog URLs on Nginx?
Use one rewrite line with a quoted regular expression for year, month, day and slug, and the permanent flag. The slug in parentheses reappears as $1 in the destination.
Why does Nginx say my rewrite has an unexpected character?
Braces in a regular expression must be inside quotes in an Nginx config, otherwise the parser reads them as block delimiters.
Can I host the Squarespace copy on a cheap VPS?
Yes. Nginx serves static files with little CPU. The hosting picker can help you compare it with managed static hosts.
What happens to my Squarespace store?
It does not move. Commerce runs on Squarespace’s servers, so link to a store you run elsewhere or keep Squarespace for that part.
Official documentation
Free tools for this job
- Squarespace Exit PlannerStep-by-step guide and checklist generator for leaving Squarespace.
- No-Code Lock-in ScoreAnalyze any platform and get a portability score with data export options.
- Static Hosting PickerAnswer 5 questions and get the best hosting recommendation for your exported site.
- HTTP Header SEO InspectorInspect SEO-relevant HTTP headers for URL lists in bulk.
Get the Squarespace files first
Paste your public Squarespace URL into the export form and download a ZIP you can deploy to Nginx. The Free plan covers 1 site, 5 exports a month, 15 pages and 20 MB per export. Professional is a $9.99 one-time purchase with unlimited pages.