How to Deploy React App on Shared Hosting (Cpanel)

Video Tutorial

Step by step video tutorial to deploy react.js web app on cPanel hosting

Steps to Deploy React App on Shared Hosting (Cpanel)

Step 0: Get the Bluehost Web Hosting (Recommended)

Step 1: Add new key named “homepage” and add your domain name or specific route where you would like to host your react web app.

Example: “homepage”: “https://startupholic.com/start-a-blog/”

Step 2: Creating a build of your react.js app using “npm run build” command.

Step 3: Create a zip file of your build.

Step 4: Uploading the zip file on your web server/cpanel/hosting in root directory or your specified sub folder (Should be as per the Step 1)

In most of the cases location will be: /public_html/yourwebsite/

Step 5: Adding .htaccess file in above specified directory as per below configuration

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

Demo: https://startupholic.com/start-a-blog/

Leave a Comment