I have an Angular 8 app and the .htaccess works correctly, however, I have added some functionality recently where the app calls a local .php proxy file which then calls a remote API and returns the result back to the app.
The issue is that the .htaccess is not allowing the angular app to call the .php proxy file as the .htaccess is rewriting the request to the .php proxy file and redirecting to load the app instead of the .php proxy file.
In short, I need to 1) force https, 2) allow calls to any files in root/php/. to be allowed and 3) requests for other destination to redirect to the angular app.
I'm very confused by .htaccess but this is what I have so far...it's not working of course :)
RewriteEngine On
# -- REDIRECTION to https:
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# --
#-- Allow direct to /php
RewriteCond %{REQUEST_URI} "php/" [OR]
RewriteRule (.*) $1 [L]
#-- Redirect remaining to angular app
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) index.html [NC,L]