Angular HTML5 mode, router going to otherwise state on page reload Angular HTML5 mode, router going to otherwise state on page reload angularjs angularjs

Angular HTML5 mode, router going to otherwise state on page reload


In order to support reloading of HTML5 mode route URLs, you need to implement server-side URL rewriting to direct non-file requests (that is, requests that aren't explicitly for an existing file) to your index file, typically index.html.

From the documentation

Using this mode requires URL rewriting on server side, basically you have to rewrite all your links to entry point of your application (e.g. index.html).

Your rewrite rule should not have any # in the destination URL. Instead, use this

RewriteEngine on# Don't rewrite filesRewriteCond %{REQUEST_FILENAME} -fRewriteRule ^ - [L]# Rewrite everything else to index.html to allow html5 state linksRewriteRule ^ index.php [L]

Source ~ https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode

Also, there's no need to set RewriteBase.