DEV Community

Discussion on: Deploy / Host your React App with cPanel in Under 5 Minutes

Collapse
 
maujor profile image
maujor

Hi there,
Can someone help me?
Suppose my React app is hosted at: http://pushstart/myapp
In order the routes works, how does would be my .htaccess file?
TIA

Collapse
 
doonsnboons profile image
doonsnboons

RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]

into your .htaccess .
note: ./index.html when your index.html and .htaccess in same folder. if you have put your react app in some other folder then ./someotherfolder/index.html