Hosting static sites and JavaScript framework builds

Deploy the output of Astro, Hugo, Eleventy, Jekyll, or a React, Vue or Next.js static export to Traxio, with routing rules for single-page apps.

Guide2 min readLast updated
On this page
  1. 1. Build locally
  2. 2. Upload the output
  3. 3. Single-page apps: route everything to index.html
  4. 4. Caching assets
  5. Forms and APIs
  6. Common questions

If your site builds to static files, you don’t need a Node.js app running on the server at all: upload the output and it’s served directly, which is the fastest option. (If you do need server-side Node.js, that’s supported too. Can I run Node.js, Python or Ruby apps on Traxio?)

1. Build locally

ToolCommandOutput folder
Vite (React, Vue, Svelte)npm run builddist/
Next.js with output: 'export'npm run buildout/
Astronpm run builddist/
Hugohugopublic/
Eleventynpx @11ty/eleventy_site/
Jekyllbundle exec jekyll build_site/

2. Upload the output

Upload the contents of the output folder to public_html — zip it, upload and extract. How to upload and extract a zip file

3. Single-page apps: route everything to index.html

Client-side routers (React Router, Vue Router) need the server to return index.html for paths like /dashboard. Add to public_html/.htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]

Static site generators that create a real folder per page don’t need this.

4. Caching assets

Build tools add hashes to file names, so they can be cached for a long time:

<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType text/css "access plus 1 year"
 ExpiresByType application/javascript "access plus 1 year"
 ExpiresByType image/webp "access plus 1 year"
</IfModule>

Forms and APIs

Static sites can call third-party APIs from the browser. For form handling or small server logic, a PHP script alongside the static files works fine. Sending email from your website reliably

Prefer to follow along?

New to Traxio? The PHP hosting page lists the PHP versions, database and tools every account gets.

Common questions

Can I host a static site built with Hugo, Eleventy or a JavaScript framework?

Yes. Build the site on your own machine and upload the generated output to public_html — a static site is just files, so it runs as fast as anything can and needs no PHP or database at all.

Spotted something out of date or unclear? Tell us and we’ll fix it.

Keep going