What you’ll need
- A project that builds to static files
- DirectAdmin access
A static build doesn’t need a Node.js app running on the server, so it’s fast and light on your account. You’ll build, upload and configure routing. Hosting static sites and JavaScript framework builds
Steps
Step 1: Set the base path
If the app will live at the domain root, make sure its base path is
/(Vite:base: '/').Step 2: Build
Run
npm run build. Note the output folder (dist/,out/orbuild/).Step 3: Zip the output’s contents
Select everything inside the output folder and zip it.
Step 4: Upload and extract
Upload to
public_htmland extract, then delete the zip. How to upload and extract a zip fileStep 5: Add routing for single-page apps
Create
public_html/.htaccess:RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L]Step 6: Test deep links
Visit an inner route directly, such as
/about, in a private window, and refresh it.Step 7: Force HTTPS
Add the HTTPS redirect above the routing rules. How to force HTTPS (redirect HTTP to HTTPS)
Check it worked
The home page and a directly visited inner route both load and survive a browser refresh over HTTPS.
If something goes wrong
| What happens | What to do |
|---|---|
| Blank page, console shows 404 for JS files | Wrong base path in the build config. |
| Inner routes 404 on refresh | The routing .htaccess is missing or in the wrong folder. |
Traxio accounts include SSH, Git, cron and PHP 7.4 to 8.3. Try the PHP hosting is free for 30 days with no card, then £0.99 a month.