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

234
Vistas
Laravel-React application has .htaccess configuration problem

I am Developing a React application with api calls to a laravel api. I uploaded the build folder after running "npm run buil" in the root of the website. I have then created a /api folder and uploaded the laravel project there. I created a database and imported the Database structure after running the laravel migrations. then in the htaccess file I wanted to redirect calls to the clientside to /index.html and calls to the /api folder to /api/public/index.php

I was looking at this post forthe htaccess file but it still does not work.

htacces file in public_html:

#redirect http to https
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.beyondthepack.com/$1 [R,L]


RewriteEngine on
#redirect /api calls
RewriteCond %{REQUEST_URI} ^/api/
RewriteRule (.*) /api/public/index.php [L]

#redirect al other calls
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]


what I want to do is redirect all request to index.html EXCEPT the requests to the api folder. the code I have does not work, what happen is:

  • all requests to the root and sub folders work fine
  • all of the requests to the /api folder fail with error code 500.

this is the header

in the server error log i do not see anything (I am using bluehost).

I am also having problem with CORS origin and I am ignoring it with a firefox plug in temporarily so that I can fix this problem first and then allow CORS in the .htaccess (I wasn't successful at that).

I do believe it is likely that the problem is in the htaccess files.

This is my first time deploying an app and I am not sure where the problem is.

over 4 years ago · Santiago Trujillo
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