Basic instructions - there are two things you need from this repo for your single page app to run on GitHub Pages.
- Copy over the [
404.html
][404html] file to your repo as is- Note that if you are setting up a Project Pages site and not using a [custom domain][customdomain] (i.e. your site's address is
username.github.io/repo-name
), then you need to set [pathSegmentsToKeep
to1
in the404.html
file][pathsegmentstokeep] in order to keep/repo-name
in the path after the redirect. If you are using React Router you'll need to tell it to use therepo-name
as thebasename
, for example<BrowserRouter basename="/repo-name" />
.
- Note that if you are setting up a Project Pages site and not using a [custom domain][customdomain] (i.e. your site's address is
- Copy the [redirect script][indexhtmlscript] in the
index.html
file and add it to yourindex.html
file - Note that the redirect script must be placed before your single page app script in yourindex.html
file.