I am building my first angularjs app in 1.6x and my router is resulting in a 404 errors
my router looks like this:
app.config(function($routeProvider, $locationProvider) {
$locationProvider.html5Mode(true);
$routeProvider
.when('/account', {
templateUrl: 'views/account/welcome.html',
}) //works
.when('/account/emails', {
templateUrl: 'views/account/email.html',
controller: 'emailController'
}) //404 error
.when('/account/wallet', {
templateUrl: 'views/account/wallet.html',
}) //404 error
.when('/account/settings', {
templateUrl: 'views/account/settings.html',
}) //404 error
.when('/account/logout', {
templateUrl: 'views/account/logout.html',
}) //404 error
.otherwise({
redirectTo: '/'
}) //works
});
and my htaccess looks like this:
Options +FollowSymLinks
<ifModule mod_rewrite.c>
RewriteEngine On
Options FollowSymLinks
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /#/$1 [L]
</ifModule>
So my router works correctly within the app, but if my browser address is at say //localhost/account/emails
or a similar path and I refresh the page, I get a 404 error. This also happens when I address the path directly from the browser.
//localhost/
and //localhost/account
work because the are actual paths in the apps file system with respective index.html files. What am I doing wrong here?