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
 
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
 
fernandoperaltacarlos profile image
Fernando Peralta

Fantรกstic, thank you

Collapse
 
byandrev profile image
Andres Parra

Thanks ๐Ÿ™

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
 
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