32
loading...
This website collects cookies to deliver better user experience
npx create-react-app hostinger-react-app
for a new app called "hostinger-react-app" (or whatever you choose to call your app). Once it has finished installing, you should be able to run npm start
in the terminal and see the following in your browser at localhost:3000
:"homepage": "https://hostinger-react-app.com"
to the package.json
file, so it will look like:{
"name": "hostinger-react-app",
"version": "0.1.0",
"homepage": "https://hostinger-react-app.com",
"private": true,
"dependencies": {
...
npm run build
in your terminal to create the production build of your app, that will be used to deploy to Hostinger. When the build completes, you should see a build folder and this in the terminal:The project was built assuming it is hosted at https://hostinger-react-app.com/.
(a problem that I had when first built my app), then you can configure the homepage another way. If you do see this line, you can skip to the Compress section..env
at the root level of your project, so that it's at the same level of your package.json
. Inside the file, add PUBLIC_URL=https://hostinger-react-app.com
. Now, when you run npm run build
, you should see it points the domain.public_html
folder. Once it's finished uploading, go to the file manager to check that your files are present. .htaccess
file inside your public_html
folder with the following code:<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
.htaccess
file, but in my experience, this configuration makes sure that apps that use routing will work.