Redirecting URLs

If you happen to change the URL of any already-published entry, it is recommended that you redirect the previous URL to the newer one. This is considered as an appropriate SEO best practice as users trying to visit the older link to the website will be automatically taken to the newer link, instead of seeing a ‘Page not found’ error.

Let’s learn how to manage URL redirects using your Contentstack-powered websites.

Create a content type to handle URL redirects

You need to create a separate content type to manage the redirection of the changed URLs.

  1. Create a new content type within your Contentstack stack.
  2. Provide a suitable name for the content type, such as Redirect.
    Set it as a ‘Multiple’ content type of ‘Content Block’ type.
  3. Add two Single Line Textbox fields to the content type.
  4. Name the fields From and To, respectively.

Create entries to manage redirection of URLs

If you change the URL of any published entry, perform the following steps to manage URL redirects:

  1. Create an entry for your Redirect content type.
  2. In the From field, mention the URL that has been modified or no longer exists.
  3. In the To field, mention the new URL.
  4. After you enter relevant content in all the available fields, save and publish the entry to the specified publishing environment.

Now, if any user visits the old URL, he/she will be redirected to the new URL automatically.

Was this article helpful?
top-arrow