Most websites, even ones that have a perfect URL structure from the beginning, may need URL redirects sooner or later. URL redirects are small tasks that carry a big value. Since one of our fields of expertise is Drupal website support & maintenance, we often face website redirect tasks.
Today, our team shares their thoughts on what redirects are, in what situations they are needed, how they can help you, and how to redirect a website URL on a Drupal website with the help of the Redirect module. This will also include the simplest answer to the popular question “How to create a 301 redirect?”
What is a website redirect?
URL redirection, also known as URL forwarding, is a technique used on the World Wide Web that takes one website URL and points it to another. When someone visits the original address, they are taken to a new one. A URL redirect tells a user’s browser where to find the content they are looking for.
Temporary and permanent redirects
Web page redirects can be temporary or permanent. They are used to inform search engines whether the page has changed its address forever or this is just a temporary measure. They are associated with the corresponding HTTP status codes — 301 and 302 (the most widely used ones on the whole list of statuses from 301 to 307):
- 301 – The page has moved permanently.
- 302 – The page has moved temporarily.
Why redirect a website URL: common scenarios
If a page is no longer available at its old address, a redirect will prevent your visitors from getting a 404 “Not found” error when they visit it (from saved bookmarks, shared links, and so on). Keeping your website clean from broken links helps you reduce the bounce rate and improve session duration, which is very important for SEO.
Redirects are also a great way to inform the search engines that the new address is now official and should “inherit” all the SEO achievements of the old page. According to Moz (the creators of the famous SEO toolset), 301 redirects pass between 90-99% of link equity (ranking power) to the new URL. This means you are not losing any of your previous SEO efforts.
Here are the situations when it may be necessary to redirect a website to another URL. Depending on the situation, this can apply to the entire website or single pages:
- Moving your site to a new domain (if you have purchased the domain of your dream, if you have to change domains due to intellectual property issues, or in other situations).
- Forwarding multiple domains to a single one (if you have purchased multiple domains, if users regularly misspell your domain in some common way, or in other situations).
- Forwarding subdomains to your main domain (for example, if you initially had “blog.mywebsite.com” and now you want to make it “mywebsite.com/blog”).
- Directing all traffic to a single (“canonical”) URL (if a website uses both a WWW and a non-WWW version).
- Changing a URL structure due to website redesign.
- Redirecting duplicate content to the original page to avoid the confusion of search engines and users.
- Fixing a mistake or a typo in a URL (web addresses need to be both human-readable and SEO-friendly, so sometimes fixing an important issue in them is worth a redirect).
- Saving a situation, like when a wrong URL has been mistakenly shared with many people (e.g. via a newsletter to thousands of customers).
- Creating a simple, brief, and catchy URL for print advertising campaigns.
How to redirect a URL with the help of the Redirect Drupal module
Sites built on content management systems (aka CMSs) offer hassle-free ways to redirect a website URL. Drupal is no exception. Of course, this can be done by a developer in the .htaccess file on the server, but there are much more user-friendly tools that offer intuitive interfaces. One of these for Drupal sites is the Redirect module. It has been recently updated by its creators.
The module allows you to easily create manual redirects from one URL to another and maintain a canonical URL for all content. This contributed module comes as a package of three submodules:
- Redirect. It allows you to redirect a website URL to another one.
- Redirect 404. It logs 404 errors and allows you to create a redirect for these pages.
- Redirect domain. It allows you to perform a redirect between different domains.
By just enabling the main module, you get a simple interface that makes it immediately clear to non-tech savvy users how to do 301 redirect and more. We have also recorded a video tutorial that is waiting for you at the end of the page.
On the Configuration — Search and metadata — Redirect page, we see the page where all your redirects will be stored. You will be able to easily find the necessary ones through filtering (by source, destination, status code, and original language). It’s possible to edit or delete them from this page.
We need to hit the “Add redirect” button and then enter the details:
- the source URL
- the destination URL
- the status (from 301 to 307)
The default status is 301, which is recommended, but you can change it on the Settings tab if needed.
The module has plenty of capabilities that developers love it for (Views API integration, integration with Drupal's page cache for performance optimization, redirect counter, automatic cleanup of inactive redirects, and much more). An important point is the module can team up with the Pathauto module to automatically generate path redirects and make sure the URL changes do not break the existing links.
Need help with your URLs?
Send tasks to experts! We have shared a basic guide on how to redirect a URL to another URL in Drupal. Our Drupal team is always there for you if you need:
- assistance in installing and configuring the module
- recommendations from our SEO team on your URL structure
- more consultations on how to forward or redirect a URL
- help with website redirects of any complexity
- and much more
Drop us a line today and let’s make sure your customers and search engines find your pages at the right addresses! We will also be glad to hear from you about any ideas on site optimization, design, or development.