Article Series icon

The Contentful SEO guide

SEO for URLs & redirects

Picture of Joshua LohrPicture of Rob RemingtonPicture of Nick SwitzerPicture of Allan White

Joshua Lohr, Rob Remington, Nick Switzer, Allan White

Updated: December 6, 2023

This is chapter 6 of the series,The Contentful SEO guide.

Summary

URLs and redirects are a key piece of both the organizational structure of your website and the findability of your content for search engines. Both can be managed as content in Contentful, but we recommend taking care to ensure your governance rules ensure a small set of users who understand the impact of their work can create and edit them.

URL slugs

Before we talk about slugs, let’s first discuss URLs in general. URLs help search engines to understand:

  • the structure of your site (through folder organization), and
  • your page’s content (through keyword usage in URL slugs).

In Contentful, the URL path can be configured to allow content creators to choose the folder in which the page falls in, however, depending on your content model, you may want to limit this to ensure content creators choose the appropriate path. In our “Building Block: Essentials” content model, we allow for content creators to select where the entry will be housed, or to select “no prefix” which places the entry at the root.

Animated screen recording of URL slug selection in the Contentful UI
Example URL slug prefix selection in the Contentful UI.

This feature shows the power of a headless CMS and the SEO benefit of Contentful to seamlessly place or move content wherever you like. Remember the days of monolithic CMSes, wherein you were limited to where you put pages and empty folders were common? This was a true productivity inhibitor. With a headless CMS, you can publish content anywhere you want it. This allows you to use clear, concise, and hierarchically organized folder structures with ease.

Beneath the URL prefix, we have the URL slug, which we’ve configured to generate based on the Entry Title (which can likewise be configured to remove stop words and special characters, as well as use lower case). Content creators can override the auto-generated URL slug by editing this field, though you may want to put limitations here.

Optimization tips

URL slug pitfalls, such as using file extensions (e.g., .html), are thankfully taken care of and prevented by Contentful. That said, it’s still a good idea to ensure the following is included in your URL slugs:

  • Keywords: Include descriptive phrases/keywords in URL slugs and subfolders.
  • Casing: Always use lowercase in URL slugs.
  • Conjunction: Avoid conjoining words in URL slugs, “likethisexample,” and instead separate words with hyphens “-” to ensure they are readable by users and search engines alike.
  • Special characters: Avoid non-ASCII characters in URLs, such as parentheses, brackets, semicolons, % and @ symbols, etc.

Validation & help text

Validation

Configure your URLs to avoid the pitfalls above and use SEO best practice.

Help text

  • Here’s an example of what you can put in the Help text field which will show up below the URL prefix field and help content creators select the appropriate URL path:

“A slug prefix for the page URL. If noPrefix selected, the slug will not have a prefix.”

  • Here’s an example of what you can put in the Help text field which will show up below the URL slug field and help content creators craft the ideal URL slug:

“This field is auto-generated using the entry title, which should already include keywords. Avoid upper case, conjoined words “likethisexample” (separating words with hyphens “-”), and special characters (such as , ; [ { @ % $, etc.).”

Redirect management

URL redirects prevent dead ends (e.g., 404 errors) and get users to where they need to be when a URL has changed. They are also critical to retaining SEO value a page has earned throughout its existence. This can be either for a page that is temporarily moved or is permanently sunsetting.

The primary types of redirects:

  • Permanent move: A 301 redirect is a permanent redirect, signally to search engines to index the destination URL and pass all earned SEO equity to the destination URL.
  • Temporary move: A 302 redirect is a temporary redirect, signally to search engines to retain indexation of the origin URL and retain all earned SEO equity at origin URL.
  • Avoid these: A meta refresh is a client-side redirect that executes after a certain period of time. These have been abused over time so much so that search engines recommend against using them.

Optimization tips

  • Use 301 redirect status by default, allowing for usage of 302 redirects where needed.
  • Avoid usage of meta refresh redirects at all costs.

Validation & help text

Redirects can be managed just like content types in Contentful. They need to be configured as a content type and then they can be managed similar to how you might manage any site component:

Example Contentful UI screenshot of URL redirect content model
Example content model for URL redirects in Contentful UI

“From” field:

  • Create a “Text” field type, select “Short text” field, and mark “This field represents the Entry title.”
  • Mark as a “Required field” and as a “Unique field.”
  • Here’s an example of what you can put in the “Help text” field which will show up below the “From” field and provide content creators guidance on which URL to put where:

“Enter the old URL you would like users to be redirected from.”

  • For the above help text, you may want/need to specify that users enter a relative or absolute URL path if your configuration relies on that.

“To” field:

  • Create a “Text” field type and select “Short text” field.
  • Mark as a “Required field” only.
  • Here’s an example of what you can put in the “Help text” field which will show up below the “To” field and provide content creators guidance on which URL to put where:

“Enter the URL you would like users to be redirected to.”

  • Again, for the above help text, you may want/need to specify that users enter a relative or absolute URL path if your configuration relies on that.

“Permanent” field:

  • Create a “Boolean” field type.
  • Mark as a “Required field.”
  • Leave the “True” condition as set to “Yes” and the “False” condition as “No.”
  • Here’s an example of what you can put in the “Help text” field which will show up below the “To” field and provide content creators guidance on which URL to put where:

“Redirects are normally permanent. When in doubt, set to permanent, or ask a member of the {team name}.”

  • The “Permanent” field will allow for content creators the option to toggle between redirect types, specifically 301 redirects and 302 redirects. The configuration above will select 301 redirect types by default, which is ideal.
  • It could be best to limit access to this using role-based permissions since redirects can be complicated to manage and risky to let any content creator manage.
  • Check out our article on composable redirects for a deep dive into redirect management in a headless CMS.

Up next

Let’s talk next about SEO best practices for images and Open Graph, and how to manage these within your Contenful content model.

Written by

Picture of Joshua Lohr

Joshua Lohr

Josh is the SEO Lead at Contentful. With 15 years of experience working directly in SEO for global brands and agencies, he gets his kicks playing a variety of instruments and appreciating the nature of his adopted home in Scotland.

Picture of Rob Remington

Rob Remington

Practice Architect

Rob Remington is a Practice Architect at Contentful, where he collaborates across all areas of the company to ensure our technical teams have the resources they need to help our customers succeed.

Picture of Nick Switzer

Nick Switzer

Senior Solution Engineer

Nick is a technical people-person who lives for solving business problems with technology. He is a solution engineer at Contentful with 14 years of experience in the CMS space and a background in enterprise web development.

Picture of Allan White

Allan White

Senior Solution Engineer

Allan White is a Senior Enterprise Solutions Engineer at Contentful. A former Contentful customer, he has 25 years of experience in design, video, UX and web development. You can catch him on Twitter or in the Contentful Slack Community.

Unlock the power of digital content
Build experiences that drive your business forward with the composable content platform.
add-circle arrow-right remove style-two-pin-marker subtract-circle remove