Is there a configuration in Github Pages that allows you to redirect everything to index.html for a Single Page App?

后端 未结 6 740
甜味超标
甜味超标 2021-01-17 15:28

I\'m trying to post my SPA app that works fine locally but when I push it to Github Pages, the interior pages don\'t register if you navigate to them directly.

For

6条回答
  •  星月不相逢
    2021-01-17 16:11

    I just built this tiny package (for bower / npm) to solves that exact problem so I thought I'd share it here as an answer to your question,

    https://github.com/websemantics/gh-pages-spa

    If you include the package in your 404.html and index.html pages, it will redirect all the traffic to Index.html,

    It supports Project and User/Org Pages type repositories, handles QueryStrings and comes with a working example,

提交回复
热议问题