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

93
Vistas
React.js in subfolder and htaccess

I have backend (Symfony) and frontend (React.js).

RewriteEngine On
 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(api/.*)$ public/index.php?/$1 [L,QSA,PT]
RewriteRule ^$ /fe/build/ [L]

I neeed forward requests beginning by /api to public/index.php. It's working. Problem is with frontend. I need other requests forward to fe/build folder where index.html with all assets.

Now I get content of fe/build/index.html but I have problem with loading assets.

In console I have following error:

static/js/main.97d34693.js NOT FOUND

I think that static/js/main.97d34693.js is loading from root folder and not from fe/build folder. Somebody know what am I doing bad?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

RewriteRule ^$ /fe/build/ [L]

You are only forwarding requests for the root. If you "need [all] other requests forward to..." then you need to remove the $ (end-of-string anchor) on the RewriteRule pattern. For example:

RewriteRule ^ /fe/build/ [L]

However, this assumes you have another .htaccess file at /fe/build/.htaccess containing mod_rewrite directives associated with your frontend/reactjs routing. If not then change the rule to the following instead in order to prevent rewriting requests for itself:

RewriteRule !^fe/build/ /fe/build/ [L]
about 4 years ago · Juan Pablo Isaza Denunciar
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