Safely and easily manage your website's HTTP redirects.
Easily and safely manage your site’s redirects the WordPress way. There are many redirect plugins available. Most of them store redirects in the options table or in custom tables. Most of them provide tons of unnecessary options. Some of them have serious performance implications (404 error logging). Safe Redirect Manager stores redirects as Custom Post Types. This makes your data portable and your website scalable. Safe Redirect Manager is built to handle enterprise level traffic and is used on major publishing websites. The plugin comes with only what you need following the WordPress mantra, decisions not options. Actions and filters make the plugin very extensible.
There are no overarching settings for this plugin. To manage redirects, navigate to the administration panel (“Tools” > “Safe Redirect Manager”).
Each redirect contains a few fields that you can utilize:
This should be a path relative to the root of your WordPress installation. When someone visits your site with a path that matches this one, a redirect will occur. If your site is located at http://example.com/wp/
and you wanted to redirect http://example.com/wp/about
to http://example.com
, your “Redirect From” would be /about
.
Clicking the “Enable Regex” checkbox allows you to use regular expressions in your path. There are many great tutorials on regular expressions.
You can also use wildcards in your “Redirect From” paths. By adding an *
at the end of a URL, your redirect will match any request that starts with your “Redirect From”. Wildcards support replacements. This means if you have a wildcard in your from path that matches a string, you can have that string replace a wildcard character in your “Redirect To” path. For example, if your “Redirect From” is /test/*
, your “Redirect To” is http://google.com/*
, and the requested path is /test/string
, the user would be redirect to http://google.com/string
.
This should be a path (i.e. /test
) or a URL (i.e. http://example.com/wp/test
). If a requested path matches “Redirect From”, they will be redirected here. “Redirect To” supports wildcard and regular expression replacements.
HTTP status codes are numbers that contain information about a request (i.e. whether it was successful, unauthorized, not found, etc). You should almost always use either 302 (temporarily moved) or 301 (permanently moved).
Note:
srm_max_redirects
that you can utilize to up this number.srm_additional_status_codes
filter to add status codes if needed.wp_die
screen with an optional message.Safe Redirect Manager includes a number of actions and filters developers can make use of. These are documented on the Safe Redirect Manager developer documentation micro-site.
Install the plugin in WordPress. You can download a zip via GitHub and upload it using the WordPress plugin uploader (“Plugins” > “Add New” > “Upload Plugin”).
download-artifact
from v3 to v4 (props @iamdharmesh, @jeffpaul via #372).phpcs:ignore
on the now safe ini_set()
(props @philipjohn, @ravinderk via #355).Cypress
from 13.0.0 to 13.1.0, @10up/cypress-wp-utils
from 0.1.0 to 0.2.0, @wordpress/env
from 5.3.0 to 8.7.0, cypress-mochawesome-reporter
from 3.4.0 to 3.5.1 and node-wp-i18n
from 1.2.5 to 1.2.7 (props @iamdharmesh, @ravinderk via #349).export
to export redirects into a CSV file. (props @zamanq, @jeffpaul, @Sidsector9 via #299).Active
to Stable
(props @jeffpaul, @Sidsector9, @peterwilsoncc via #303).post_status
property from redirects data (props @tlovett1, @pdclark, @mehul0810, @Sidsector9, @dkotter, @nateconley, @sksaju, @ravinderk via #326).srm_check_for_possible_redirect_loops
filter to true
(props @joshbetz, @tlovett1, @Sidsector9, @ravinderk via #341).auto_detect_line_endings
deprecation warning in PHP 8.1 and above (props @dhewer, @jayedul, @Sidsector9, @ravinderk via #327).semver
from 7.3.8 to 7.5.4 (props @dependabot, @dkotter, @Sidsector9 via #334, #342).tough-cookie
from 2.5.0 to 4.1.3 (props @dependabot, @faisal-alvi via #337).@cypress/request
from 2.88.10 to 3.0.0 (props @dependabot, @faisal-alvi, @ravinderk via #337, #343).cypress
from 11.2.0 to 13.0.0 (props @dependabot, @ravinderk via #343).message
array key exists before we use it (props @dkotter, @ocean90, @peterwilsoncc via #319).Note that this version bumps the PHP minimum from 5.6 to 7.4 and the WordPress minimum from 4.6 to 5.7.
/
are buggy (props @dhanendran, @peterwilsoncc via #279).srm_additional_status_codes
filter hook (props @Sidsector9, @faisal-alvi via #312).got
from 10.7.0 to 11.8.5 (props @dependabot, @peterwilsoncc via #286).@wordpress/env
from 4.9.0 to 5.3.0 (props @dependabot, @peterwilsoncc via #286).simple-git
from 3.9.0 to 3.16.0 (props @dependabot, @Sidsector9, @peterwilsoncc via #294, #302).http-cache-semantics
from 4.1.0 to 4.1.1 (props @dependabot, @peterwilsoncc via #305).For the changelog of earlier versions, please refer to the changelog on github.com.