Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

235
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda