Goal
html5Mode時に、/
以外のパスでリロードしてもページが正しく表示される。
問題点
- パスが
/
ではないので、リロードで404 - jsファイルなどは相対パスで書かれているので404
解決策
html5Modeを有効化
app.config.js
angular
.module('angularApp')
.config(['$locationProvider', function($locationProvider) {
$locationProvider.html5Mode(true);
}]);
index.htmlへrewrite
stereokaiのsnippetをGruntfile.jsへ追加。
install connect-modrewrite
$ npm install --save-dev connect-modrewrite
base hrefを設定
index.html
<!doctype html>
<html class="no-js">
<head>
<base href="/">