DEV Community

Cover image for Setup a redirect on Github Pages

Setup a redirect on Github Pages

Stephen Belovarich on March 25, 2019

There are several static site generators and even a cli called gh-pages that enable you to easily publish a Github pages site. Sometimes it can be ...
Collapse
 
hitblast profile image
HitBlast

Thanks for sharing! Well as of 2023, it seems like you don't actually need the _config.yml file anymore for whatever reason.

Collapse
 
steveblue profile image
Stephen Belovarich

That's good because it was always superfluous for most use cases.

Collapse
 
ginigangadharan profile image
Gineesh Madapparambath

Cool ! Thanks for Sharing.

Btw, any idea how to achieve parameter/url passing as well ?

Expection :
mypage on old github should point to mypage on newsite.com
olduser.github.io/mypage --> newsite.com/mypage

thanks

Collapse
 
trusktr profile image
Joe Pea

You can use JavaScript instead of <meta>, then set window.location = to whatever you want (including paths, query strings, hashes, etc)

Collapse
 
dynamicmortal profile image
Mihir Amin • Edited

How to redirect a user while clicking on social icons to my social handle id page? I have hosted my page on github but I wrote as
href="example.com" it doesn't redirect to it why is it so ?
Github Repo Link:- github.com/DYNAMICMORTAL/SketchWeb...

Website:- dynamicmortal.github.io/SketchWebs...

Collapse
 
mjbryan10 profile image
Matthew James Bryan

Nice article, thanks for the information!

Collapse
 
sureshsaragadam profile image
sureshsaragadam

just now, with the help of this article i have fwd my github page to my dev.to blog page

thank you very much

Collapse
 
andymagill profile image
Andrew Magill

Nice article. I didn't think of adding a canonical link. But why bother using jekyl? Why not just put up a complete html ?

Collapse
 
steveblue profile image
Stephen Belovarich • Edited

At the time of writing this you had to set a theme as described using jekyl. It is part of the configuration set by Github. Moral of the story, you somehow need to set a theme even if you don’t use it.

Collapse
 
vjnvisakh profile image
Visakh Vijayan

When I open my github page, I want the index.html to be displayed by default. Without the "index.html" in the URL. How to do that?

Collapse
 
gmondello profile image
Greg Mondello

This is great -- thank you for posting this!