Level up your headless SEO with a composable URL redirect

Published on June 14, 2022

Level up your headless SEO with a composable URL redirect

The URL redirect is central to the web content management experience thanks to its ability to ensure content managers can move content without a negative impact on search engine rankings, and provide easy, memorable and trackable ways for end users to access content. 

Most traditional, monolithic CMSes include a way for content creators to manage a URL redirect because they make the assumption that all content is a web page. In contrast, Contentful enables omnichannel content management, reuse, and delivery as part of a composable architecture, but that doesn’t mean you have to give up the convenience of managing a URL redirect alongside the content it affects. 

For the foreseeable future, the web will almost always be a relevant channel, so let’s apply the benefits of a composable content platform to build a better version of URL redirect management that can scale with your organization.


The URL redirect as an integrated microservice

Composable architecture enables an organization to build a tech stack that is perfectly suited to its needs by integrating microservices, rather than trying to modify business practices to work within the constraints of a single, monolithic application.

Oftentimes, a URL redirect may be considered a web-specific delivery concern that should be handled by an application and kept out of the reach of content editors. However, given the impact they can have on an organization’s ability to convert leads from organic search and paid marketing, URL redirects should be simple and straightforward to manage for non-technical users.

By integrating Contentful with a redirect management tool, content creators get a streamlined management experience, alongside a redirect solution that can scale independent of any specific application that is displaying web content.

Composable URL redirects

Composable URL redirects to the rescue

Before we dig into the specifics of the solution, let’s take a look at two instances where a modern, composable URL redirect architecture can make an organization more agile and create faster time to value.

1. Update content as frequently as you like

A URL redirect is a key part of the toolbox for any modern marketer looking to build a complex campaign or manage a large repository of content that is subject to frequent updates. 

In the case of a landing page serving as the conversion point for a campaign with multiple entry points, content creators will need the ability to easily create multiple trackable, channel-specific vanity URLs, which may even include a query parameter or two.

On top of that, content creators with a huge amount of content undergoing frequent updates will likely be updating the URLs used to access individual pages as their content changes. That update can be extremely detrimental to a website’s SEO if the redirects aren’t handled properly and high-ranking content starts directing users to a generic homepage or, even worse, returning 404 errors.

With composable redirects, we can easily put the ability to create vanity URLs and manage redirects in the hands of the marketers responsible for the outcomes associated with that content.

2. Take away barriers to replatforming

URL redirect management can happen server-side (using software like Apache), at the application level, or even client-side using Javascript redirects. Each scenario, and plenty of others like them, create a dependency on developers and makes replatforming substantially more difficult in the future.

When a monolithic application is handling all of your URL redirects, it may not feel like a problematic dependency in the short term, but it will almost always create issues at some point. I’ve seen this most often when an organization managing their URL redirects within a single application wants to do something as simple as a rebrand, consolidate a subdomain and old domain into a new site, or implement an information architecture refresh on their public website.

As navigation structure changes, pages are combined to reflect new offerings and old content is archived, the team quickly realizes that all of the routing information is tangled up in a chaotic mess of CMS backend, frontend templates and server-level directives. The team spends a huge amount of time doing their best to untangle that web, but, without fail, the days, and sometimes weeks, after launch are plagued with the SEO nightmare of hundreds of 404ing URLs and a steadily declining pagerank. This costs the business leads and, ultimately, revenue.

Fortunately, with a modern content platform and composable architecture, it’s possible, and straightforward, to create a simple and intuitive URL redirect management experience that is accessible to every day content editors (without asking them to learn HTML and PHP).

Many websites

Build a URL redirect prototype in Contentful

To get started, all you need to do is select a URL redirect management microservice that can handle the volume and types of redirects you’ll be creating, and has an API that will allow you to programmatically create, update, and delete redirects.

The two I personally like, and have had success with, are easyredir and redirect.pizza — both have great feature sets and APIs.

Next, you’ll need to implement fields in your Contentful content model to store the URL redirect information, and make it simple for non-technical content creators to manage.

This is where you can take advantage of all of the fantastic content modeling features available out of the box with Contentful to do things like: add help text, restrict the number of redirects that can be added to a single page, or apply a custom permission to ensure only approved users can create and manage URL redirects.

You can even include more granular control over the type of redirect content managers create by adding a field to your content model that allows them to control the http status code associated with the redirect (assuming the redirect manager supports it). The two most common directives are: 301 redirect, which is a permanent redirect, or a 302, temporary redirect.

The baseline Redirect URL content type ends up being fairly minimal, with two fields (three if you decide to manage the type of redirect in Contentful). The Internal Name field contains an easy way to understand and search for the redirect. The URL field is where the content manager adds the old URL, without the domain name. Excluding the domain name lets our redirect manager do its work without duplicating information related to the original URL or any new domains that are eventually incorporated into the project.

Outside of the reference to our Redirect URL, the only other field we’re concerned with is the slug on our parent entry, which serves as the target URL for our redirect and canonical URL for the content.

Redirect URL content type

Now that you’ve selected a URL redirect management service and built the content model to handle storing the content, you just have to connect the two. Webhooks are a great way to alert an external application to changes that happen within your Contentful space, including publishing an entry with a new URL redirect. I recommend creating a webhook, using event triggers and filters, that will fire when an entry that includes a URL redirect is published.

Connecting URL redirect management with the content modelAlert an external application to changes that happen within your Contentful space

Finally, we need a service to listen for that webhook, check the payload for a URL redirect that doesn't exist in our redirect manager yet, and create that URL redirect via the redirect manager’s API.

In my use case, I used Make, a fantastic automation platform that makes tasks like this simple. To get this up and running, I pointed my Contentful webhook to my Make listener and used Make to receive the webhook payload, make a request back to Contentful’s (lightning-fast) Content Delivery API and make a subsequent POST request to my redirect manager to create the new redirect.

After about an hour of work, I had a prototype for composable URL redirects up and running. This gave my content creators a simple and familiar way to manage redirects alongside their content and completely decoupled my redirects from my application, all taking advantage of the power of a composable architecture for a more agile and scalable experience moving forward.

Summary and next steps

The real beauty of a composable architecture is the way it enables any team to quickly prototype and incorporate new functionality to meet needs as they arise. Redirects are a great example of how we can create a simple process for content creators to make them even more efficient.

A process that previously required developer intervention for every request is now as simple as: open an existing piece of content (or create a new page), indicate that this page will be located at a different URL by updating the URL path, set up a redirect to indicate the page has moved permanently, confirm all the correct page URLs are included in your list of redirects, and publish. Start to finish, that will require about five minutes of your day.

Want to try it for yourself? Sign up for a free Contentful account and start building in moments!

For more about Headless SEO please refer to this guide.

Subscribe for updates

Build better digital experiences with Contentful updates direct to your inbox.

Related articles

Content operations is the secret behind streamlining content management and delivery so your creative teams can focus on exceeding their content goals.
Guides

Content operations: Getting started with a people-first approach

October 19, 2023

Enhance team collaboration by integrating Contentful with Microsoft Teams, utilizing Adaptive Cards to create visually appealing, interactive notifications.
Guides

Integrating Contentful with Microsoft Teams using Adaptive Cards

July 5, 2024

Let's explore how to use Swift 5 to process JSON data, and learn how to make requests to Contentful APIs and deserialize the data to render the results.
Guides

Deserializing JSON in Swift 5 and Contentful

November 24, 2022

Contentful Logo 2.5 Dark

Ready to start building?

Put everything you learned into action. Create and publish your content with Contentful — no credit card required.

Get started