Retour
DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Install / Use
/learn @nystudio107/RetourREADME
DEPRECATED
This Craft CMS 2.x plugin is no longer supported, but it is fully functional, and you may continue to use it as you see fit. The license also allows you to fork it and make changes as needed for legacy support reasons.
The Craft CMS 3.x version of this plugin can be found here: craft-retour and can also be installed via the Craft Plugin Store in the Craft CP.
Retour plugin for Craft CMS
Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.

Related: Retour for Craft 3.x
Installation
To install Retour, follow these steps:
- Download & unzip the file and place the
retourdirectory into yourcraft/pluginsdirectory - -OR- do a
git clone https://github.com/nystudio107/retour.gitdirectly into yourcraft/pluginsfolder. You can then update it withgit pull - -OR- install with Composer via
composer require nystudio107/retour - Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
retourfor Craft to see it. GitHub recently started appending-master(the branch name) to the name of the folder for zip file downloads.
Retour works on Craft 2.4.x, Craft 2.5.x, and Craft 2.6.x.
Retour Overview
Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
In addition to supporting traditional exact and RegEx matching of URL patterns, Retour also has a Retour Redirect FieldType that you can add to your entries. This allows you to have dynamic entry redirects that have access to the data in your entries when matching URL patterns.
Retour will also automatically create a redirect for you if you change an entry's slug, or move an entry around in a Structure.
Retour is written to be performant. There is no impact on your website's performance until a 404 exception happens; and even then the resulting matching happens with minimal impact.
Don't just rebuild a website. Transition it with Retour.
Why Use a Plugin for Redirects?
If you have just a few static redirects, then your best bet is to put them in your .htaccess file, or better yet, in your .conf file for your virtual host. However, there are a number of cases where using a plugin to handle it is a better solution:
- If you have a large number of redirects, it will slow down every single request your web server handles unnecessarily if they are in
.htaccessor.conf - Often the URL patterns from the legacy website do not match the new website URLs in a deterministic way, which makes creating redirects difficult
- Sometimes you don't have access to the server config files, or you want to give your client the ability to manage redirects easily
Retour solves these problems:
- Retour only attempts to do a redirect after the web server has already thrown a 404 exception. Once a redirect mapping is successfully determined, it also caches the result for speedy resolution of the next redirect request.
- Retour also gives you the ability to do Dynamic Entry Redirects that allow you to import a piece of legacy data into your entries to use as a key for determining the new URL mapping. In this way, utterly dissimilar URLs can be mapped for redirection effectively.
- It provides an easy to use GUI that the client can use from Craft's AdminCP, and keeps statistics on the 404 hits (and misses)
A Word about .htaccess
People using the Apache webserver are familiar with the .htaccess file, and may even be using it for redirects. It's very likely that you should not be using .htaccess at all; instead you should disable .htaccess via AllowOverride none and make your configuration changes in your webserver configuration files. From Apache HTTP Server Tutorial: .htaccess files
There are two main reasons to avoid the use of .htaccess files.
The first of these is performance. When AllowOverride is set to allow the
use of .htaccess files, httpd will look in every directory for .htaccess
files. Thus, permitting .htaccess files causes a performance hit, whether or
not you actually even use them! Also, the .htaccess file is loaded every
time a document is requested.
Further note that httpd must look for .htaccess files in all higher-level
directories, in order to have a full complement of directives that it must
apply. (See section on how directives are applied.) Thus, if a file is
requested out of a directory /www/htdocs/example, httpd must look for the
following files:
/.htaccess
/www/.htaccess
/www/htdocs/.htaccess
/www/htdocs/example/.htaccess
And so, for each file access out of that directory, there are 4 additional
file-system accesses, even if none of those files are present. (Note that
this would only be the case if .htaccess files were enabled for /, which is
not usually the case.)
In the case of RewriteRule directives, in .htaccess context these regular
expressions must be re-compiled with every request to the directory, whereas
in main server configuration context they are compiled once and cached.
Additionally, the rules themselves are more complicated, as one must work
around the restrictions that come with per-directory context and
mod_rewrite. Consult the Rewrite Guide for more detail on this subject.
As you can see, avoiding the use of .htaccess completely is best if at all possible, and especially avoid it for RewriteRule directives, such as 404 rewrites.
Dynamic Entry Redirects
Retour implements a Retour Redirect FieldType that you can add to your Entry Types. Retour will look for 404 (Not Found) URLs that match the Legacy URL Pattern, and redirect them to this entry's URL.
You also get the context of the entry that you can use when matching legacy URLs; so if you've imported a field called recipeid into your new website, you can the Retour Redirect FieldType look for it in your Legacy URL Pattern, e.g.: /old-recipes/{recipeid}
This allows you to key off of a piece of legacy data that was imported, for the cases when the new URL patterns don't look anything like the Legacy URL Patterns, or follow any pattern that RegEx is useful for matching.

Creating a Retour Redirect Field
Create a Retour Redirect field as you would any other field; then set the default values for it. For new entries, it will default to the values entered here, so you can put your matching pattern in once, rather than having to do it for each entry.
- Default Legacy URL Pattern - Enter the URL pattern that Retour should match. This matches against the path, the part of the URL after the domain name. You can include tags that output entry properties, such as
{title}or{myCustomField}in the text field below. e.g.: Exact Match:/recipes/{recipeid}or RegEx Match:.*RecipeID={recipeid}$where{recipeid}is a field handle to a field in this entry. - Default Pattern Match Type - What type of matching should be done with the Legacy URL Pattern. Details on RegEx matching can be found at regexr.com. If a plugin provides a custom matching function, you can select it here.
- Default Redirect Type - Select whether the redirect should be permanent or temporary.
- Redirect Changeable - Whether to allow the user to change the redirect while editing the entry.
Configuring a Retour Redirect Field
- Legacy URL Pattern - Enter the URL pattern that Retour should match. This matches against the path, the part of the URL after the domain name. You can include tags that output entry properties, such as
{title}or{myCustomField}in the text field below. e.g.: Exact Match:/recipes/{recipeid}or RegEx Match:.*RecipeID={recipeid}$where{recipeid}is a field handle to a field in this entry. - Pattern Match Type - What type of matching should be done with the Legacy URL Pattern. Details on RegEx matching can be found at regexr.com. If a plugin provides a custom matching function, you can select it here.
- Redirect Type - Select whether the redirect should be permanent or temporary.
Note: if you add a Retour Redirect FieldType to an existing Section, or you import data from a foreign source into a Section with a Retour Redirect FieldType, the default values you set for the Retour Redirect FieldType will not be propagated to the entry yet. To cause that to happen, go to Settings->Sections then click on the Section to edit it, and hit Save. This will cause all of the entries in that section to be re-saved, and Retour will fill in the default field values.
Static Redirects
Manually Creating Static Redirects
Static Redirects are useful when the Legacy URL Patterns and the new URL patterns are deterministic. You can create them by clicking on Retour->Redirects and then clicking on the + New Static Redirect button.
- Legacy URL Pattern - Enter the URL pattern that Retour should match. This matches against the path, the part of the URL after the domain name. e.g.: Exact Match:
/recipes/or RegEx Match:.*RecipeID=(.*) - Destination URL - Enter the destination URL that should be redirected to. This can either be a fully qualified URL or a relative URL. e.g.: Exact Match:
/new-recipes/or RegEx Match:/new-recipes/$1 - Pattern Match Type - What type of matching should be done with the Legacy URL Pattern. Details on RegEx matching can be found at regexr.com. If a plugin provides a custom matching functio
Related Skills
bluebubbles
349.2kUse when you need to send or manage iMessages via BlueBubbles (recommended iMessage integration). Calls go through the generic message tool with channel="bluebubbles".
bear-notes
349.2kCreate, search, and manage Bear notes via grizzly CLI.
claude-seo
4.0kUniversal SEO skill for Claude Code. 19 sub-skills, 12 subagents, 3 extensions (DataForSEO, Firecrawl, Banana). Technical SEO, E-E-A-T, schema, GEO/AEO, backlinks, local SEO, maps intelligence, Google APIs, and PDF/Excel reporting.
claude-ads
1.6kComprehensive paid advertising audit & optimization skill for Claude Code. 186 checks across Google, Meta, YouTube, LinkedIn, TikTok & Microsoft Ads with weighted scoring, parallel agents, and industry templates.
