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

233
Views
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
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!