简体   繁体   中英

Angular js - LocationProvider HTML5mode() and urls

i've enabled the

locationProvider.HTML5mode(true);

then i putted on top of index.html :

<html ng-app="app">
<head>
 <base href="/projects/www/#/" />

So if i browse the site using internal links for example(#/users) everything works and urls are re-writed from projects/www/#/users to projects/www/users

BUT if i go directly by browser to projects/www/users i get page not found.

The only one direct url that works is :

projects/www/

What this could be?

Ok i fixed it was to add some server side htaccess code:

RewriteEngine on
RewriteBase /Projects/www
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM