AngularJS: How to remove #!/ (bang prefix) from URL?

Add to your html file <head> <base href="/foldername/"> </head>

and this one is for your app.js $locationProvider.html5Mode(true);

this is for .htaccess create file if you don't have.

RewriteEngine On 
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d  
RewriteRule ^ - [L]
RewriteRule ^ /foldername/

Below code will remove exclamatory (!) mark in URL

$locationProvider.hashPrefix('');

or else go to Routing issue with AngularJS project using yeoman setup

it worked for me


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.


Update

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 <head> on your index.html

<head>
    ...
    <base href="/">
</head>