I would like an example of htaccess to use in my Apache.
The scenario is as follows:
I have an application in Angular 4 that needs to run on a separate back-end server. I build using the ng build command (for some internal problems I do not use ng build --prod) and put the generated files in the htdocs / app folder.
In need of the project, I need to use relative urls so that apache can redirect.
Ex: The url that would be link , should be api / app / something.
I already searched Google and Stackoverflow, and none of the suggested solutions for redirection worked. My htacces looks 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 on my angular server, it sees the api / app path and redirects to localhost. I already have this proxy running on dev via angular-cli, but I need to use this also in apache.
Another thing is that when I use my routes without the "#", it can not reload. If I get out of root ('/') it can follow the route, but when I update em it gives 404 error.
I hope it was clear. Thanks!
P.S. Not Apache's handle, so I'm picking it up like this.
; D