Your sites Log in Sign up Menu

Regular Expressions in Redirects

I was wondering how to use regular expressions in redirects. Consider the following case: I want to redirect users to my github page when they type domain.tld/github without the link being case sencitive. So all URLs including /github, /gitHub, or even /GitHuB would redirect to the same destination. I tried to type it as follows: /github/i, but thast didn't work. Thanks!


2 years ago, 2 replies   Improve this question

Try the following:

From: /github(.*)
To: https://github.com/

This is a hacky workaround – it will redirect all broken links starting with /github. Redirects are evaluated case-insensitively but you need to make sure that the Regular Expression mode is triggered to get this behaviour. Otherwise, Blot will just match the URL literally in a case-sensitive manner.

I will likely need to match literal URL redirects case-insensitively but this will be a breaking change. Please email me if you'd like a notification when this is ready.

Answered 2 years ago · Improve this answer

Worked like a charm. Thanks David. ☺

Answered 2 years ago · Improve this answer