How to remove # from URL in AngularJS?

How to remove # from URL in AngularJS?

In this post we will give you information about How to remove # from URL in AngularJS?. Hear we will give you detail about How to remove # from URL in AngularJS?And how to use it also give you demo for it if it is necessary.

If you work on AngularJS web application using angular route then you notice one thing. If you click on any hyper links it makes like as bellow:




I mean always “#” will be there, But when we live this web application then it should delete “#” from URL, because it makes issue when we share link on facebook or etc.

But should look likes:




But we can remove easily using “$locationProvider.html5Mode(true);”. You can do it like as bellow simple example i did, but make sure you have to first add base tag on your head tag like as bellow:

Your root file


<base href="/">



Angular JS Route

Also see:AngularJS – simple image upload with preview example in PHP

var app = angular.module('main-App',['ngRoute']);


function($routeProvider, $locationProvider) {


when('/', {

templateUrl: 'templates/home.html',

controller: 'HomeController'


when('/users', {

templateUrl: 'templates/users.html',

controller: 'UserController'



redirectTo: '/'




Hope this code and post will helped you for implement How to remove # from URL in AngularJS?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  27  =  30

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US