Angular.js How to remove hash from url?
Configuration:
1 2 3 4 |
$locationProvider .html5Mode(true); |
.htaccess file in root directory:
1 2 3 4 5 6 7 8 9 10 11 |
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] # 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
1 2 3 |
<a href="/path">link</a> |
Link in Browser:
1 2 3 |
http://www.example.com/base/path |
Source: http://stackoverflow.com/questions/16677528/location-switching-between-html5-and-hashbang-mode-link-rewriting […]