I already have done $locationProvider.html5Mode(true); but it is not working. Whenever I access http://example.com it goes to http://example.
If you want to remove this prefix, add this code to your config:
appModule.config(['$locationProvider', function($locationProvider) {
$locationProvider.hashPrefix('');
}]);
Source here for more information.
If you want to remove the whole prefix (# and not only !), you may try this solution:
1) Activate the HTML5 mode and remove the prefix ! in your module config
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('');
2) And then set base to / in the on your index.html
...