GitLab Pages Redirection


There is nothing like learning something new just after you realize what was released broke several referenced URLs. After upgrading to the latest v4 release of Gatsby, a plugin to generate the blog post pages needed some drastic refactoring, as the interface to consume the plugin had changed.

After two hours of work, everything was operational and deployed to the internet. As I looked at past Linkedin posts, I realized several URLs broke with the changes as the links are case-sensitive. OOPS... The new segments I liked better than the ones in the Linkedin posts, so what is one to do? If this were a problem in my professional career, redirects would be the solution. However, given my hosting strategy (GitLab Pages) I have limited control over the environment's configuration.

Then I happen across this document. Of course, the team(s) at GitLab have a solution to redirects for Page. It's quite an elegant solution as well. All it took was one file named _redirects with a space-delimited list of redirect entries in the construct of {incoming path} {outgoing path} {response HTTP status code}. After a small test, I used the sitemap to create an entry for all existing posts. Within minutes the configuration was deployed and tested. The only functionality I have not seen but would like to see, is rewriting all incoming paths to lowercase. The case sensitivity is only an issue if the user is typing in the URL to a specific post. Which I do not expect is occurring often, if ever.