DEV Community

Cover image for Deploy React App on Hostinger

Deploy React App on Hostinger

Mark Woodson on November 07, 2021

Today, I'll show you the steps needed to deploy a react app to Hostinger. The tutorial will be broken down into the following steps: Create and B...
Collapse
 
yuridevat profile image
Julia πŸ‘©πŸ»β€πŸ’» GDE •

Thank you for your article. After unzipping the folder everything worked out fine. Tried to follow other tutorials, they did not work. Glad, I found your article!

Collapse
 
brennamacquarrie profile image
brenna macquarrie • • Edited

Thanks! The .env solution I did need.
We had to unzip the file before uploading (instead of importing the zip) just a note incase it helps others.

Cheers!

Collapse
 
mohit_00777 profile image
Mohit Koli •

Still the clearest guide for this β€” a couple of notes for anyone landing
here in 2026.

If you're on Vite rather than CRA (create-react-app was deprecated in early
2025, so most new projects are), the equivalents are:

  • base: '/' in vite.config.js instead of homepage in package.json
  • build output is dist/, not build/
  • the .htaccess block above is still exactly what you need β€” client-side routing 404s without it

For the 403 / blank page a few people hit in the comments: the usual cause
is uploading the build folder itself instead of its contents. Files need to
land as public_html/index.html, not public_html/build/index.html. If you
zip, zip from inside the build folder β€” select the files, not the folder.

Also worth clearing up, since two comments mention it: "The project was
built assuming it is hosted at /" is not an error when you're deploying to
the domain root. That message is correct behaviour β€” no fix needed.

Collapse
 
ninise profile image
Nikitin Nikita •

Thank you for the topic, a couple of issues I got:

  1. The project was built assuming it is hosted at / I couldn't make it to be a domain name as you did, nevertheless, I tried both variants you mentioned.
  2. Zipping a build folder also did not help. I uploaded all content of the build folder into ** public_html** and that's it.

Anyway, it was a big help!

Collapse
 
jagdishlove profile image
Jagdish Singh Mehra •

I was also getting same

The project was built assuming it is hosted at /

I use .env and it fixed, but still my website not showing up and showing 403 error.

Collapse
 
leandro_rodrigolezcano_4 profile image
Leandro Rodrigo Lezcano •

I'll tell you how it worked for me, I created a build folder with npm run build, then with filezilla I exported all the files and folders that were inside the build to public_html. Later in the file manager of my site in hostinger I added the ".htaccess" file with the code shared in this post and it worked with all the routes.

Collapse
 
panewedaniela profile image
Daniela Panewe •

Your article helps me to solve a problem i'm facing since 2 days. Thank you

Collapse
 
imhamad profile image
Hamad •

Would you best, if you can cover auto-deployment via git in a seperate topic as well.
PS: Insightful article

Collapse
 
mwoodson11 profile image
Mark Woodson •

Is this what you're looking for, my friend?
dev.to/mwoodson11/create-deploymen...

Collapse
 
fernandoperaltacarlos profile image
Fernando Peralta •

FantΓ‘stic, thank you

Collapse
 
byandrev profile image
Andres Parra •

Thanks πŸ™

Collapse
 
avpizarro profile image
Alejandra Valdes Pizarro •

Thanks it works! πŸ₯³ As it is a single page app it doesn't seem to need the .htaccess file. Is that correct?

Collapse
 
mwoodson11 profile image
Mark Woodson •

Yes you should be good! Also, I've tried redoing this tutorial recently and even with multiple pages, it seems that the file is no longer needed, but I leave that step just in case that problem arises