0

I am trying to create a React website and get it hosted. I've built the website and it works fine on LocalHost:3000, however, problems arrise when I try to host it. I've used commands such as npm run build as well as yarn run build (hoping that it would change something, it didn't.). Additionally, I pasted the following code in my .htaccess file:

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

I've attached a picture here showing the error on the right and my public_html folder where I unzipped the build file:

Contents of public_html directory

1

public_html directory

2

Nothing seems to be working and my website is simply showing error 403.

A few more random pieces of information:

  • My domain/website works fine as I was able to run a WordPress website on it beforehand with no issues
  • I'm using the "Premium Web Hosting" from Hostinger
  • I've made my website using React as well as NextUi

If anyone could provide some assistance as to what I might be doing wrong here and how to fix it, it would be greatly appreciated!! Do LMK if more information is needed.

vimuth
  • 5,064
  • 33
  • 79
  • 116
  • I voted to close this question because a 403 error is a very generic "access denied" error. It could be a misconfiguration, a permissions problem, or a coding error. More information about the specific cause of your error is available in your server's error log. There is no way to accurately answer this question without seeing the logs. Any answers here will be guesses and there are hundreds if not thousands of possible answers. – Stephen Ostermiller Apr 11 '23 at 00:03

0 Answers0