0
I would like an example of htaccess to use in my Apache.
The scenario is as follows:
I have an Angular 4 application that needs to run on a separate back-end server. I build using the ng build command (for some internal problems I don’t use ng build --Prod) and place the generated files in the htdocs/app folder.
Because of the project’s need, I need to use relative urls so apache can redirect.
Ex: The url that would be http://www.app.com/app/something, must be api/app/Something.
I’ve searched Google and Stackoverflow and none of the suggested solutions for redirecting worked. My htacces are like this:
RewriteEngine on
RewriteRule "api/app" "http://localhost:8080/app/rest/$1" [P]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) index.html [NC,L]
The idea is that when I make a request in my Angular Service, it sees the api/app path and redirects to the localhost. I already have this proxy working in dev via angular-cli, but I need to use this also in apache.
Another thing is when I use my routes without the "#", it can’t reload. If I quit root ('/') it can follow the route, but when I update it gives error 404.
I hope I made myself clear. Thanks!
P.S. I don’t know Apache, so I’m getting it this way.
;D