ReactHosting.guide Get Hostinger →
← All guides

How to deploy a React + Vite app to Hostinger

React apps built with Vite are fast to develop and fast to run — but when it comes to hosting, many developers hit a wall. Vercel and Netlify are great for side projects, but sooner or later you want your own hosting: a custom domain, more control, or a plan that scales without surprise bills. Hostinger is one of the most affordable options that doesn't compromise on reliability. This guide walks you through deploying your Vite app to Hostinger from scratch, using both the File Manager and Git-based deployment.

What you'll need

  • A React + Vite project that builds without errors locally
  • A Hostinger account (Shared, Cloud, or VPS — all work, differences noted below)
  • Node.js 18+ on your machine

Step 1: Build your Vite app

Before you do anything with Hostinger, make sure your app builds cleanly:

npm run build

This creates a dist/ folder containing your static files — HTML, JS, CSS, and assets. That folder is what you'll upload to Hostinger. If you see build errors, fix those first before continuing.

Open dist/index.html locally to sanity-check the output looks right.

Step 2: Choose your Hostinger plan

Hostinger offers three main options relevant to React apps:

Shared Hosting

Cheapest option (from ~$2.99/mo), good for static React apps with no backend. You upload your dist/ folder and you're done. Limitation: no Node.js runtime, so if your app needs a server-side API, this won't work alone.

Cloud Hosting

Middle ground — better performance and resources than shared, still straightforward to use. Good if you expect moderate traffic.

VPS

Full control, Node.js runtime available, you manage the server. Overkill for a pure static Vite app, but necessary if you have a backend (see the Node.js + Express article for that setup).

For a standard React + Vite app with no backend, Shared Hosting is enough.

Step 3a: Deploy via File Manager (simplest)

This method works on any Hostinger plan and requires no extra tools.

  1. Log in to hPanel (Hostinger's control panel)
  2. Go to Files → File Manager
  3. Navigate to the public_html folder — this is your web root
  4. Delete any default files already there (usually a placeholder index.html)
  5. Click Upload and select all files from your local dist/ folder
  6. Make sure index.html ends up directly inside public_html, not in a subfolder

Visit your domain — your app should be live.

React Router users

You'll get a 404 on page refresh because Hostinger doesn't know to redirect all routes to index.html. Fix this by creating a .htaccess file in public_html with:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.html [QSA,L]

Step 3b: Deploy via Git (recommended for ongoing updates)

If you'll be updating the site regularly, setting up Git deployment saves you from manually uploading files every time.

  1. In hPanel, go to Advanced → Git
  2. Click Create and connect your repository (GitHub, GitLab, or Bitbucket)
  3. Set the deployment path to public_html
  4. Set the branch to main (or whichever branch you deploy from)

Hostinger's Git deployment pulls your repository files directly — it does not run npm run build for you on shared or cloud hosting. Two options:

Option A — Commit your dist/ folder

Remove dist/ from .gitignore, build locally, commit, and push. Simple, but not ideal practice.

Option B — Use a CI/CD pipeline (recommended)

A GitHub Action builds your app and pushes the dist/ contents to a deploy branch. Hostinger pulls from that branch.

A minimal GitHub Action for Option B:

name: Deploy to Hostinger
on:
  push:
    branches: [main]
jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      - run: npm install
      - run: npm run build
      - name: Push dist to deploy branch
        run: |
          git config user.email "ci@example.com"
          git config user.name "CI"
          git add dist -f
          git commit -m "Deploy"
          git push origin HEAD:deploy --force

Then point Hostinger's Git deployment at the deploy branch.

Step 4: Set up your custom domain

If you bought your domain through Hostinger, it's already pointed at your hosting. If you bought it elsewhere:

  1. In hPanel go to Domains → Add Domain
  2. Add your domain and follow the instructions to update your DNS nameservers at your registrar
  3. DNS propagation takes up to 24 hours, but usually under 2

Step 5: Enable HTTPS

hPanel makes this one click. Go to Security → SSL and enable the free Let's Encrypt certificate. Do this after your domain is pointing correctly, otherwise the certificate won't issue.

Troubleshooting

Blank page after upload

Check that index.html is directly in public_html, not inside a dist/ subfolder.

404 on refresh

Add the .htaccess file from Step 3a above.

Assets not loading

Open your browser's dev tools and check the network tab for 404s on JS/CSS files. This usually means your Vite base config is wrong. If your app lives at a subdirectory (e.g. yourdomain.com/app/), set base: '/app/' in vite.config.js.

Git deploy not triggering

Make sure the branch name in hPanel matches exactly, including capitalisation.

Summary

Deploying a React + Vite app to Hostinger is straightforward once you understand what Hostinger actually does with your files. For static apps, shared hosting is plenty. Use the File Manager for a one-off deploy, Git deployment for anything you'll maintain long-term. The .htaccess fix for React Router is the one thing that trips up almost everyone the first time — now you know.

Ready to get started? Plans start at $2.99/mo.

Get Hostinger hosting →

Hostinger — fast, affordable hosting for React apps. Starting at $2.99/mo.

Get Hostinger →