angular - nginx or apache how to serve content from /subfolder no matter what url you are at -
i have frontend app, written in angular, hosted @ http://localhost/subfolder/myapp
when go app, redirects route1, url appears as: http://localhost/subfolder/myapp/route1
but when refresh browser, 404 not found error. think that's because there no physical index.html in /subfolder/myapp/route1 , /subfolder/myapp/route1 not physical folder.
so wrote rewrite rule
rewrite ^/subfolder/myapp/.+$ /subfolder/myapp last;
but since when go http://localhost/subfolder/myapp redirected http://localhost/subfolder/myapp/route1, , rule redirecting me http://localhost/subfolder/myapp, in infinite redirect state (too many redirect problem)
what can in nginx solve problem? or apache?
figured out:
location /subfolder/myapp/ { try_files $uri /subfolder/myapp/index.html; } location /subfolder2/myapp/ { try_files $uri /subfolder2/myapp/index.html; }
Comments
Post a Comment