It’s a common and essential feature of many WordPress sites but also one that’s often overlooked as basic or misunderstood.
That feature is; redirects.
Redirects on WordPress are simple. Install one of the many plugins, add the redirects you need and you’re done. We never give much thought into the mechanics of this or what may change between different types of hosting environments. In particular, a serverless-static hosting environment like Shifter.
When moving to a static site generator or purely CDN based hosting environment, the redirect features offered by Apache or NGINX no longer apply.
For example, .htaccess files are a feature unique to Apache environments and the same applies to .conf files for users familiar with NGINX. Instead, when serving static files over a CDN in a serverless hosting environment, we need to take another step back to make this happen
Our solution to this was updating our static site generator to work with the most popular redirect WordPress plugin; Redirection.
Shifter now supports non-regex redirects without any tricks or false pages. Just add the redirects you need with a trailing slash, and you’re done.
We decided to focus on supporting the Redirection plugin developed by John Godley, for the sheer number of active installations (+1M) and the features it offers. It’s one of the most robust redirect plugins out there offering an intuitive user interface, WP-CLI features, and WP-REST API support.
Official site: https://redirection.me/
How to create Redirects on Shifter
First, start by installing and activating the Redirection plugin. For a step by step please refer to the installation guide here.
Navigate to the Redirection plugin settings. Add the specific redirects you need with the full path and trailing slash.
We recommend that you test these by viewing the front-end of your WordPress site before creating the static artifact.
Once you’re happy with the results, generate a new artifact and deploy!
At the moment Shifter does not support, regex, also known as wildcard redirects. This is something we are working on to be a native part of Shifter’s static site generator.
However, this feature is available in a very-beta and open source plugin we call, WP Serverless Redirects. This plugin is currently in development and may change without notice. If you’d like to give it a try contact us and we’ll help you get set up.