Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

307
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda