I build standalone web using node js (Sails) for backend and angularJs for frontend on linux environment and nginx for production mode. I want to remove hash (#!) in my url. I follow this tutorial
Now my website is working properly without hash (#!) in every page as long as I don't refresh, but when I refresh, it call my API from backend or 404 not found. I following those tutorial to put
<base href="/"/>
on my layout.ejs but it still not work.
Here is my sample code for routing angularjs using state
(function() {
'use strict';
angular
.module('buyer.routes', ['ui.router'])
.config(function($locationProvider, $urlMatcherFactoryProvider, $urlRouterProvider, $stateProvider){
$urlRouterProvider.otherwise("/");
$urlMatcherFactoryProvider.caseInsensitive(true);
$stateProvider
.state('home', {
url: '/',
templateUrl: 'templates/buyer/buyer-index.html',
controller: 'BuyerController',
controllerAs: 'vm'
})
.state('home.testi', {
url: 'testimoni',
templateUrl: 'templates/buyer/buyer-testimoni.html',
controller: 'BuyerTestimoniController',
controllerAs: 'vm',
data : { pageTitle: 'Testimoni page'}
})
$locationProvider.hashPrefix('');
$locationProvider.html5Mode(true);
})
}());
Whats wrong with my code? Thankyou