I'm using self hosting servicestack for a single page application with mvc and razor. On the same apphost i serve some api. The problem is i need some a 404 redirect to the main path "/" to get html5 mode running in AngularJS. I've tried:
DefaultRedirectPath = "/"
this.GlobalHtmlErrorHttpHandler = new RazorHandler("/");
How can i get any 404 request to the main page?
You can register a Fallback Route with a wildcard for this which will let you handle unknown server routes in your Service in order to return the default page so routing can be handled in the client app, e.g:
This is also the strategy used by the techstacks.io AngularJS Single Page App which also supports server-generated pages with techstacks.io/?html=server.