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?
Apparently the rules worked, but SiteGround's NGinx cache was causing the site to ultimately not react to the changed rules.