Search code examples
.htaccessgithubwebserverweb-hostinggithub-pages

Options for changing the directory index when using GitHub Pages


I'm using GitHub Pages to host a site and I'd like to rename my index.html file to something else (e.g. home.html). The issue with this is that GitHub specifically looks for and loads the default 'index.html' as the directory index.

I understand changing the directory index is possible via server configuration files such as .htaccess, but GitHub Pages does not support these.

I've looked around for a bit with no luck, so I'm reaching out to see if I have any options for changing the name of the 'index.html' file in an attempt to 'prettify' links back to my home page.

Update: I'd prefer to actually change the name of the directory index file GitHub is looking for versus using a redirect.


Solution

  • One possibility would be to add a redirect from the index.html page to the new home.html.

    As such, index.thml page remains, but almost empty.
    See "Redirect from an HTML page?" or "What is the best approach for redirection of old pages?".

    <meta http-equiv="refresh" content="0; url=home.html" />