Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
Build created with Create React App shows empty page when deployed on production

I made a very basic corporate website with create-react-app and used react-router v6 for routing. Everything works fine locally. Then I create a build folder by running following command:

npm run build

I uploaded the contents of build folder and uploaded to the server folder like: /var/www/mysite

On server I am running apache, I create apache site there and pointed root directory to be /var/www/mysite. Now when I try to run the website on my domain like:

www.mysite.com it does not work and shows blank page.

But when I upload the same build into sub folder like /var/www/mysite/v2 and then try to run www.mysite.com/v2 the site works perfectly fine.

I don't know what is wrong. I tried following in package.json file

"homepage": "."
OR
"homepage": "/"
OR
"homepage": "./"
OR
"homepage": "wwww.mysite.com/"

Here are the contents of my .htaccess file that is placed in public directory of project, it gets copied to build folder when build folder is generated:

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

Please tell me what I am doing wrong. I have spent full day trying to figure out what is wrong. This issue is not mentioned in documentation or anywhere online. I have tried all possible fixes available on similar questions but nothing works.

Note: I am not including https in above question wherever www is written because SO does not let me submit question with https.

about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!