ui-router中增加
$locationProvider.html5Mode(true);
2.根目錄增加.htaccess文件,並增加
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
3.在index.html的head標籤中增加
<base href="/">
4.若刷新頁面後樣式失效,請查看是否路徑爲"./abc"寫法,改寫成絕對路徑"/abc"