fbpx
27 C
Lahore

Angular.js How to remove hash from url?

Must read

Ayyaz Zafarhttps://www.ayyaztech.com
I am Full Stack Web Developer with 10 years of professional Experience. I have following Skills: HTML5, CSS3, Javascript, jQuery, Ajax, PHP, MySQL, jQuery, Angular, React.js, Wordpress, Codeigniter, Laravel, Node.js, Mongo DB, Express.js, GraphQL, Typescript, Apollo and many more..

Configuration:

$locationProvider
  .html5Mode(true);

.htaccess file in root directory:

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

 # If the requested resource doesn't exist, use index.html
 RewriteRule ^ /index.html

In this mode you can use links without the # in HTML files

<a href="/path">link</a>

Link in Browser:

http://www.example.com/base/path

Source: http://stackoverflow.com/questions/16677528/location-switching-between-html5-and-hashbang-mode-link-rewriting

- Advertisement -spot_img

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article