Removing # hash from URL in AngularJS

Today, We want to share with you Removing # hash from URL in AngularJS.In this post we will show you AngularJs remove # from url or setup Pretty URL, hear for How To Remove Hash From Application URL In AngularJS we will give you demo and example for implement.In this post, we will learn about Remove Hashtag From The Routing URL – $locationProvider with an example.

Removing # hash from URL in AngularJS

There are the Following The simple About Removing # hash from URL in AngularJS Full Information With Example and source code.

Read Also:  Angularjs Check duplicated value in array

As I will cover this Post with live Working example to develop remove #! from url angularjs ui router, so the remove # from url angularjs ui router for this example is following below.

Rewrite your AngularJs app url from https://www.pakainfo.com/#/path/ to https://www.pakainfo.com/path/

Way : 1) using Base href

Way 1: We have Set the simple base path href in HTML file.

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

Way : 2) using Angularjs

simple Include html5Mode inside Single page application angularjs config file.

Read Also:  jQuery Disable onClick Event listeners

app.config(function ($routeProvider,$locationProvider) {
$routeProvider
  .when('/', {
    templateUrl: 'contact-us-page.html',
    controller : 'conatctUsController'
    });
$locationProvider.html5Mode(true);
});

Way 3: using .htaccess url rewrite

Update this inside your root simple .htaccess file.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /#/$1 [L]

Web Programming Tutorials Example with Demo

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Removing # hash from URL in AngularJS.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.