Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Pages - Url Rewrite Support

I have setup a GitHub page for a site I am working on, following the steps laid out here (https://pages.github.com/)

The site I have setup is currently hosted under IIS and makes use of the URL Rewrite module.

Is there an equivalent module or similar that I could use to rewrite certain URL requests within my application?

like image 724
mindparse Avatar asked Apr 01 '15 12:04

mindparse


People also ask

Can you change the URL of GitHub Pages?

On GitHub, navigate to your site's repository. Under your repository name, click Settings. In the "Code and automation" section of the sidebar, click Pages. Under "Custom domain", type your custom domain, then click Save.

Does GitHub Pages support dynamic?

GitHub Pages doesn't support dynamic websites or anything requiring a backend or secret data. There are other sites that provide this kind of hosting, such as Netlify and Heroku, along with many others. You can also host those yourself on a VPS for relatively cheap.

What is URL rewrite rules?

In the URL Rewrite Module, a rewrite rule is defined by specifying four required pieces of information: Name of the rule. Pattern to use for matching the URL string. Optional set of conditions. Action to perform if a pattern is matched and whether all conditions checks succeed.

What is the URL for GitHub Pages?

The GitHub Pages repository URL is always https://{userid}.github.io/{reponame} The GitHub Pages URL is based on the GitHub repo URL, and takes the format https://{userid}.github.io/{reponame} . The moment you use it, GitHub Pages will generate a website based on the contents of your repo.


2 Answers

For security reasons, Github pages doesn't allow server configuration files, so, no url rewriting.

But you can use html redirection with the help of jekyll-redirect-from.

This is how github pages advises to redirect.

like image 115
David Jacquel Avatar answered Sep 17 '22 13:09

David Jacquel


For Github Pages, just copy index.html and renaming it to 404.html will work.

Reference:

  • https://help.github.com/en/github/working-with-github-pages/creating-a-custom-404-page-for-your-github-pages-site
  • https://stackoverflow.com/a/36623117/8106429
like image 45
Yilin Huang Avatar answered Sep 17 '22 13:09

Yilin Huang