Create 301 and 302 URL Redirections in Drupal

Create URL Redirections in Drupal 7

Websites change frequently and you often need to move or change URLs. Whenever you make a change, you’ll need to safely redirect the old URLs to the new URLs.

In this tutorial, I’m going to show you how to create 301 and 302 redirects for your Drupal site.

Step #1. Install and enable Redirect module

Download the Redirect module from this page.

drupal redirections

  • Install and enable the module.

Step #2. Create an internal redirect

  • Go to Configuration
  • Look in the Search and metadata section for “URL redirects”.

drupal redirections

  • Click “Add redirect”.

drupal redirections

Fill in the settings:

  • Enter the old URL into the From field
  • Enter the new URL into the To field
  • Leave the Enabled as checked.

drupal redirections

Optionally, inside “Advanced options”, change the redirect status according to your needs.

The most common are:

  • Default (301): for permanent redirects. For SEO purposes, to tell Google to index the new URL.
  • 302 Found: for temporary redirects

drupal redirections

  • Click “Save” when you’re done.

Step #4. Create an external redirect

You can also create redirects pointing outside your site.

For example, I want to use the link www.mysite.any/go-out to redirect to www.google.com with the settings below:

drupal redirections

Step #5. Test the redirect

Go to your www.mysite.any/old-url to confirm is indeed redirecting to www.mysite.any/new-url.

Step #6. Number of times a redirect is being used

You can track the number of times a redirect is being used, by checking the statistics in “Count” column from the URL redirects list:

drupal redirections

Instructor

  • Valentin discovered Joomla in 2010, and since then he has considered it as the best CMS. Valentin has been coding extensions and templates for Joomla for many years and truly enjoys helping people build their own websites with Open Source tools. He lives in San Julián, Jalisco, México.

0 0 votes
Blog Rating
Subscribe
Notify of
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
carogray

For Drupal 7. It would be very helpful to add how to configure the redirect module and explain why one would pick certain options and why it is helpful to check certain boxes – specifically Automatically create redirects when URL aliases are changed.
This is hugely helpful and we did not know about it for 2 years.
Also could you talk about Allow redirects to be saved into the page cache.?
Why would you not do this if you are caching pages for anonymous users?

1
0
Would love your thoughts, please comment.x
()
x