Managing URL redirects
Disclaimer: The content in this video remains relevant to Drupal 10 customers. An updated version of this training video is in the works and will be available soon.
Transcript
Introduction
Welcome to the GovCMS Content Administration Training series. Hi, I’m Ivan from Salsa Digital and in this video, you’ll learn about URL redirects in GovCMS. We’ll cover the following two topics:
- How URL redirects work
- How to create your own URL redirect
How URL redirects work
In the previous video, we talked about managing and creating URL aliases. Now I want to show you how to manage URL alias redirects. Managing old URLs (and making sure they still work) helps with search engine optimisation and it helps users navigate your site. The last thing a user wants to see is a “404 page not found” error. The ability to create and manage redirects is only available for site administrators, so make sure you have the correct role.
So what is a redirect?
Well, let’s start by going to the copyright page. The URL alias is “/copyright”, but what if you just migrated over to GovCMS and the old copyright page was at “/pages/copyright”? We want to keep this old URL working so if a user goes to “/pages/copyright” instead of getting a page not found or 404 error, they’ll be redirected to “/copyright”. To handle this situation we’ll simply create a redirect in GovCMS.
How to create URL redirects
Let’s now go ahead and create a redirect for the copyright page so if a user goes to “/pages/copyright” they’ll be redirected to the current “/copyright” page. To create and manage redirects you must have the site administrator role. So make sure you have the user role. Click configuration in the admin toolbar, scroll down to URL redirects and click on “Add redirect”.
In “Path” add the old URL, and in the To field, add the new URL. This field is an autocomplete, so just search for the copyright page and select it. Leave the redirect status to 301 (you can change it, but this will tell the search engines that the move is permanent). Now let’s test this out. I’ll open up another tab and go to “/pages/copyright” and this redirects us to “/copyright”. Perfect, it’s all working.
To keep tabs on all the incoming redirects for a page, just click on Edit. Then click on URL redirects and this will show you all the redirects pointing to this page.
Recap
Let’s now recap what we covered in this video. First, we learnt how URL redirects work, then we looked at how to create a URL redirect.