Site/foo/bar or site/foo/baz route to foo with path


How do i configure/use Jekyll so that

go to site/foo



I want to redirect
site/foo/* to othersite/foo/*

As long as Jekyll routes to foo I can just get the path from document.location and pass it on a with a javascript snippet. (quick dirty i know)

I only use HTML markup language to solve redirect

<meta http-equiv="refresh" content="0; url={{ }}">

First I start a new page layout and name it redirect
After that put that HTML code to the redirect.html

In the pages or posts, for example:

  to: /foo/bar/ohyoutouchmylalala

Yep. I wouldn’t say I like javascript. If one day, javascript is gone, I will invite everyone to my party bar.

1 Like

there is a plugin that may do what you want (I have not used it so I don’t know much about it):

The answer depends on how you are serving/hosting your site. Jekyll itself is just a tool for building sites, so Jekyll won’t be running when your site is live. I.e. Jekyll can’t directly route/redirect /foo/*.

Many servers/web-hosts have mechanisms to specify redirects. For example: Apache, NGINX, Netlify, and S3 all have different ways to setup redirects. Unfortunately, the popular Github-Pages hosting has no such mechanism.

As @ninja and @rdyar have mentioned, you can use meta-refresh to pseudo-redirect individual pages, but that won’t work to redirect an arbitrary sub-tree like /foo/*. Note that the meta-refresh mechanism should only be used as a last resort, when there is no other option.

1 Like

@chuckhoupt I Want to Say thank to You Chuck for sending this redirection method. I’m currently managing more than one thousand domain names that are registered for my customers.
In the old time, I have always used HTML to redirect, but after you gave me the solution, I decided to move on with HTTP redirection for my new clients.
After a few days of testing, check and compare how they work. I can agree for sure that HTTP redirection is more fit and good speed than HTML redirection.

@chuckhoupt dang, after i transfer to a HTTP redirections my customers scream at me because it make their link redirect being blocked by some social media like facebook, zalo, twitter… it force me to downgrade back to meta tag redirection. what a mess. i will never never do that again after testing if it fit and suite for business way around.

meta HTML is still the best at this moment.