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

112
Views
How to mod_rewrite / to /frontend/index.html?

I am trying to host both a PHP API and a static/built Angular app on a single Apache server (hosted by SiteGround.com).

Right now I've got this .htaccess file

RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com$ [NC]
RewriteCond %{REQUEST_URI} !frontend/
RewriteRule ^$ /index.html
RewriteRule ^/$ /index.html
RewriteRule (.*) /frontend/$1 [L]

I assumed the ^$ and ^/$ rules would be enough to make the root of mysite.com to transparently serve /frontend/index.html but i just get a 200 OK response with no content when i browse to mysite.com; however mysite.com/index.html does show my Angular app. I also tried escaping the rule with ^\/$ but that didn't work either.

I also tried making the root rules have higher priority but that didn't work

RewriteEngine on

RewriteRule ^$ /frontend/index.html [L]
RewriteRule ^\/$ /frontend/index.html [L]

RewriteCond %{HTTP_HOST} ^app.apprevenir.com$ [NC]
RewriteCond %{REQUEST_URI} !frontend/
RewriteRule (.*) /frontend/$1 [L]

What's missing from my .htaccess file?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Apparently the rules worked, but SiteGround's NGinx cache was causing the site to ultimately not react to the changed rules.

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