$locationProvider.hashPrefix('!');
$routeProvider.otherwise({redirectTo: '/main'});href="#"$rootScope.$on('$routeChangeStart', function(event, next, current) {
// добавьте здесь свою проверку на пустой hash и вызовите отмену
event.preventDefault();
});