3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

i18n対応AngularアプリケーションをFirebase Hostingで公開するときの設定

Posted at

前提

以下の記事の構成でi18n対応AngularアプリケーションをFirebase Hostingに公開したい。
https://qiita.com/daikiojm/items/c7aebeae30c86d48d0c8

設定

firebase.jsonを次のように設定する。

firebase.json
{
  "hosting": {
    "public": "dist",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ],
    "redirects": [
      {
        "source" : "/",
        "destination" : "/en",
        "type" : 301
      }
    ],
    "rewrites": [
      {
        "source": "/ja/**",
        "destination": "/ja/index.html"
      },
      {
        "source": "/en/**",
        "destination": "/en/index.html"
      }
    ]
  }
}
  • public
    • ここに設定したパス以下のファイルがデプロイされるので、今回の場合en/jaどちらのディレクトリもデプロイされる
      -  redirects
    • デフォルトの言語をenにしたいので/にアクセスした際に/enにリダイレクトするように設定
  •  redirects
    • /ja|en/**にマッチするアクセスがあった際に対応するindex.htmlを表示するように設定

参考

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?