Is there an alternative to .htaccess for GitHub Pages?

.HtaccessGithubGithub Pages

.Htaccess Problem Overview


I understand that .htaccess is not supported by GitHub Pages. Is there an alternative for password-protecting particular directories for websites hosted by GitHub Pages?

.Htaccess Solutions


Solution 1 - .Htaccess

Although you can't use .htaccess or .conf, Github has instructions on how to use the Jekyll Redirect From plugin.

https://help.github.com/articles/redirects-on-github-pages/</strike>

The page above no longer has any mention of the plugin. The direct link to the jekyll-redirect-from plugin GitHub repo is https://github.com/jekyll/jekyll-redirect-from

Solution 2 - .Htaccess

"Unfortunately, GitHub pages only supports static pages. There is no way to make it execute server-side code and thus it's impossible to protect your pages with any kind of authentication scheme. If you expand further on why you need to password-protect your pages, maybe I can help you find a workaround."

Source: https://webapps.stackexchange.com/questions/35692/is-there-an-alternative-to-using-htaccess-to-password-protect-subdirectories-in

Solution 3 - .Htaccess

I'm using a 404.html to redirect users from old S9Y index.php to my new blog on Github Pages. Check this commit: https://github.com/lionello/lionello.github.io/commit/c175f6524a53e29aea1890c8a758afd0e8944852

Solution 4 - .Htaccess

This post comes out at the top of web search when you look for .htaccess redirects in github pages. I am going to answer this question in that sense.

One option is to use a DNS redirect instead. You do this by putting a file named CNAME in the project's root directory (not sure if it works in a subdirectory). Just put the redirection URL in the file. However, there are a few limitations, e.g. you can only redirect to a website's root.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionhatmatrixView Question on Stackoverflow
Solution 1 - .HtaccessjondueckView Answer on Stackoverflow
Solution 2 - .HtaccessNicolas FloquetView Answer on Stackoverflow
Solution 3 - .HtaccesslionelloView Answer on Stackoverflow
Solution 4 - .HtaccessnomadView Answer on Stackoverflow