Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy a create-react-app to a web host (ex. Siteground)?

I'm building a react project using create-react-app and am trying to figure out how to deploy my code to my hosting server on Siteground.

Does anyone know the best way to do this? Do I import my build folder through FTP? Can I automate the process through GitHub?

Thanks in advance!

like image 537
Dane W. Iliff Avatar asked Jan 24 '18 20:01

Dane W. Iliff


Video Answer


1 Answers

I have problem deploying on siteground as well the simple solution is to have a git repo for your build and setup your public_html folder on siteground to track that git repo.

make sure to also create

.htaccess

with the content something like this

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

If you don't have that your routing won't work

Also remember to go Tools->Speed->Caching and flush the cache if you have deployed otherwise before

like image 109
Emmanuel Ajaero Avatar answered Nov 12 '22 19:11

Emmanuel Ajaero