Answer the question
In order to leave comments, you need to log in
How to change site root directory in github-pages?
Hello.
How can I change the site root directory in github-pages?
Googled but didn't understand anything, couldn't.
It is necessary that when username.github.io is opened , username.github.io/build is opened ,
so that all styles, scripts, media downloads relative to build. To have username.github.io
in the address bar instead of username.github.io/build .
Does gh-pages use .htaccess, if so how can it be done.
Tried
RewriteEngine on
DirectoryIndex build
Answer the question
In order to leave comments, you need to log in
Github Pages doesn't accept .htaccess. (this is not hosting) And you can't change the root directory as you want either.
There are 2 options:
1. Create a separate branch with site files and connect this branch to gh-pages
2. Create an empty page at the root with a redirect to /build
Github Pages is a static website hosting. This information should be enough to understand.
There is a base tag - htmlbook.ru/html/base .
If you use it, then all relative links on the page will start from where this base looks. If you need a link to another place, you can put / at the beginning of the link. In principle, the reception is quite convenient, with careful use, when you need to switch topics on the site. Although sometimes you can fly into that still hemorrhoids. For example, href="#" specified on such a page at / will point not to the same page, but to the page /build/#
Well, of course, the page itself must remain at the root, after all, static hosting
<base href="/build">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question