PHPackages                             tlovett1/safe-redirect-manager - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. tlovett1/safe-redirect-manager

ActiveWordpress-plugin[HTTP &amp; Networking](/categories/http)

tlovett1/safe-redirect-manager
==============================

Safely manage your website's HTTP redirects.

2.2.2(1y ago)3219.8k82[18 issues](https://github.com/tlovett1/safe-redirect-manager/issues)[5 PRs](https://github.com/tlovett1/safe-redirect-manager/pulls)PHPCI passing

Since Jun 18Pushed 1mo ago51 watchersCompare

[ Source](https://github.com/tlovett1/safe-redirect-manager)[ Packagist](https://packagist.org/packages/tlovett1/safe-redirect-manager)[ RSS](/packages/tlovett1-safe-redirect-manager/feed)WikiDiscussions develop Synced 3w ago

READMEChangelog (10)Dependencies (2)Versions (26)Used By (0)

Safe Redirect Manager
=====================

[](#safe-redirect-manager)

[![Safe Redirect Manager](https://github.com/10up/safe-redirect-manager/raw/develop/.wordpress-org/banner-1544x500.png)](https://github.com/10up/safe-redirect-manager/blob/develop/.wordpress-org/banner-1544x500.png)

[![Support Level](https://camo.githubusercontent.com/570a8b870e3b5e0c1805b8701b5f304aa1cf440e74807b255a4c4339af8df5f1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737570706f72742d737461626c652d626c75652e737667)](#support-level) [![Required PHP Version](https://camo.githubusercontent.com/636c9f0ba4a54f8053155d7e8e5c08c5c9f964ef4309e2c92a2390a824f4f88c/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f72657175697265642d7068702f736166652d72656469726563742d6d616e616765723f6c6162656c3d5265717569726573253230504850)](https://camo.githubusercontent.com/636c9f0ba4a54f8053155d7e8e5c08c5c9f964ef4309e2c92a2390a824f4f88c/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f72657175697265642d7068702f736166652d72656469726563742d6d616e616765723f6c6162656c3d5265717569726573253230504850) [![Required WP Version](https://camo.githubusercontent.com/8225faf76efa4d4b825bcbb3f8fc92a486180bc0ee44fc1b180d4024988cddd7/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f77702d76657273696f6e2f736166652d72656469726563742d6d616e616765723f6c6162656c3d5265717569726573253230576f72645072657373)](https://camo.githubusercontent.com/8225faf76efa4d4b825bcbb3f8fc92a486180bc0ee44fc1b180d4024988cddd7/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f77702d76657273696f6e2f736166652d72656469726563742d6d616e616765723f6c6162656c3d5265717569726573253230576f72645072657373) [![WordPress tested up to version](https://camo.githubusercontent.com/c62c5fbf281a3e71033051fbd1161607efa3ceb29e60dbfa5a2b43395f35b390/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f7465737465642f736166652d72656469726563742d6d616e616765723f636f6c6f723d253233343642343530266c6162656c3d576f72645072657373266c6f676f3d576f72645072657373266c6f676f436f6c6f723d253233303037334141)](https://camo.githubusercontent.com/c62c5fbf281a3e71033051fbd1161607efa3ceb29e60dbfa5a2b43395f35b390/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f7465737465642f736166652d72656469726563742d6d616e616765723f636f6c6f723d253233343642343530266c6162656c3d576f72645072657373266c6f676f3d576f72645072657373266c6f676f436f6c6f723d253233303037334141) [![GPLv2 License](https://camo.githubusercontent.com/bda0167db93f7b40a9c9d4c44d35d1b981ab7a17a1e41e158a66b6dda81398a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f313075702f736166652d72656469726563742d6d616e616765722e737667)](https://github.com/10up/safe-redirect-manager/blob/develop/LICENSE.md) [![Dependency Review](https://github.com/10up/safe-redirect-manager/actions/workflows/dependency-review.yml/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/dependency-review.yml) [![E2E test](https://github.com/10up/safe-redirect-manager/actions/workflows/cypress.yml/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/cypress.yml) [![PHPUnit](https://github.com/10up/safe-redirect-manager/actions/workflows/phpunit.yml/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/phpunit.yml) [![Linting](https://github.com/10up/safe-redirect-manager/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/lint.yml) [![PHPCS](https://github.com/10up/safe-redirect-manager/actions/workflows/phpcs.yml/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/phpcs.yml) [![PHPCompatibility](https://github.com/10up/safe-redirect-manager/actions/workflows/php-compatibility.yml/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/php-compatibility.yml) [![CodeQL](https://github.com/10up/safe-redirect-manager/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/10up/safe-redirect-manager/actions/workflows/github-code-scanning/codeql) [![WordPress Playground Demo](https://camo.githubusercontent.com/4cea4bfad71849f370b9a86e8a68eb57e9b8918c07401f5abce59aa9c35bd99b/68747470733a2f2f696d672e736869656c64732e696f2f776f726470726573732f706c7567696e2f762f736166652d72656469726563742d6d616e616765723f6c6f676f3d776f72647072657373266c6f676f436f6c6f723d464646464646266c6162656c3d506c617967726f756e6425323044656d6f266c6162656c436f6c6f723d33383538453926636f6c6f723d333835384539)](https://playground.wordpress.net/?blueprint-url=https://raw.githubusercontent.com/10up/safe-redirect-manager/add/playground/.wordpress-org/blueprints/blueprint.json)

> A WordPress plugin to safely manage your website's HTTP redirects.

Purpose
-------

[](#purpose)

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.

Installation
------------

[](#installation)

Install the plugin in WordPress. You can download a [zip via GitHub](https://github.com/10up/safe-redirect-manager/archive/trunk.zip) and upload it using the WordPress plugin uploader ("Plugins" &gt; "Add New" &gt; "Upload Plugin").

Configuration
-------------

[](#configuration)

There are no overarching settings for this plugin. To manage redirects, navigate to the administration panel ("Tools" &gt; "Safe Redirect Manager").

Each redirect contains a few fields that you can utilize:

#### "Redirect From"

[](#redirect-from)

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](http://www.regular-expressions.info) 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`.

#### "Redirect To"

[](#redirect-to)

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 Code"

[](#http-status-code)

[HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) 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:*

- Redirects are cached using the Transients API. Cache busts occur when redirects are added, updated, and deleted so you shouldn't be serving stale redirects.
- By default the plugin only allows at most 1000 redirects to prevent performance issues. There is a filter `srm_max_redirects` that you can utilize to up this number.
- "Redirect From" and requested paths are case insensitive by default.
- Developers can use `srm_additional_status_codes` filter to add status codes if needed.
- Rules set with 403 and 410 status codes are handled by applying the HTTP status code and render the default WordPress `wp_die` screen with an optional message.
- Rules set with a 404 status code will apply the status code and render the 404 template.
- Browsers heavily cache 301 (permanently moved) redirects. It's recommended to test your permanent redirects using the 302 (temporarily moved) status code before changing them to 301 permanently moved.

Filters
-------

[](#filters)

### Default redirect status code

[](#default-redirect-status-code)

The default redirect HTTP status code can be changed using the `srm_default_direct_status` filter.

```
add_filter(
	'srm_default_direct_status',
	/**
	 * Set the default redirect status to 301 (Moved Permanently).
	 */
	function() {
		return 301;
	}
);
```

### Redirect loops detection

[](#redirect-loops-detection)

By default redirect loop detection is enabled. To disable it, you can use the `srm_check_for_possible_redirect_loops` filter.

```
add_filter( 'srm_check_for_possible_redirect_loops', '__return_false' );
```

### Only redirect if 404 occurs

[](#only-redirect-if-404-occurs)

By default every matched URL is redirected. To only redirect matched but not found URLs (i.e., 404 pages), use `srm_redirect_only_on_404`.

```
add_filter( 'srm_redirect_only_on_404', '__return_true' );
```

CLI commands
------------

[](#cli-commands)

The following WP-CLI commands are supported by Safe Redirect Manager:

- **`wp safe-redirect-manager list`**

    List all of the currently configured redirects.
- **`wp safe-redirect-manager create   [] [] []`**

    Create a redirect. `` and `` are required parameters.

    - ``: Redirect from path. Required.
    - ``: Redirect to path. Required.
    - ``: HTTP Status Code. Optional. Default to `302`.
    - ``: Whether to enable Regular expression. Optional. Default to `false`.
    - ``: The status of the redirect. Optional. Default to `publish`.

    **Example:** `wp safe-redirect-manager create /about-us /contact-us 301`
- **`wp safe-redirect-manager delete `**

    Delete a redirect by ``.
- **`wp safe-redirect-manager update-cache`**

    Update the redirect cache.
- **`wp safe-redirect-manager import  [--source=] [--target=] [--regex=] [--code=]  [--order=]`**

    Imports redirects from a CSV file.

    - ``: Path to one or more valid CSV file for import. This file should contain redirection from and to URLs, regex flag and HTTP redirection code. Here is the example table:

        sourcetargetregexcodeorder/legacy-url/new-url03010/category-1/new-category-slug03021/tes?t/\[0-9\]+/path/\[^/\]+/?/go/here13023...............*You can also use exported redirects from "Redirection" plugin, which you can download here: /wp-admin/tools.php?page=redirection.php&amp;sub=modules*
    - `--source`: Header title for source ("from" URL) column mapping.
    - `--target`: Header title for target ("to" URL) column mapping.
    - `--regex`: Header title for regex column mapping.
    - `--code`: Header title for code column mapping.
    - `--order`: Header title for order column mapping.
- **`wp safe-redirect-manager import-htaccess `**

    Import .htaccess file redirects.

Development
-----------

[](#development)

#### Setup

[](#setup)

Follow the configuration instructions above to setup the plugin. We recommend developing the plugin locally in an environment such as [WP Local Docker](https://github.com/10up/wp-local-docker).

#### Testing

[](#testing)

Within the terminal change directories to the plugin folder. Initialize your unit testing environment by running the following command:

```
bash bin/install-wp-tests.sh database username password host version
```

Run the plugin tests:

```
phpunit
```

Translations
------------

[](#translations)

Safe Redirect Manager is available in English and other languages. A listing of those languages and instructions for translating the plugin into other languages is available on [Translating WordPress](https://translate.wordpress.org/projects/wp-plugins/safe-redirect-manager/). Many thanks to the [contributors on the translation teams](https://translate.wordpress.org/projects/wp-plugins/safe-redirect-manager/contributors/)!

Frequently Asked Questions
--------------------------

[](#frequently-asked-questions)

### Where do I report security bugs found in this plugin?

[](#where-do-i-report-security-bugs-found-in-this-plugin)

Please report security bugs found in the source code of the Safe Redirect Manager plugin through the [Patchstack Vulnerability Disclosure Program](https://patchstack.com/database/vdp/3fab514f-46ce-4b71-ab53-450228f73bde). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.

Support Level
-------------

[](#support-level)

**Stable:** 10up is not planning to develop any new features for this, but will still respond to bug reports and security concerns. We welcome PRs, but any that include new features should be small and easy to integrate and should not include breaking changes. We otherwise intend to keep this tested up to the most recent version of WordPress.

Changelog
---------

[](#changelog)

A complete listing of all notable changes to Safe Redirect Manager are documented in [CHANGELOG.md](https://github.com/10up/safe-redirect-manager/blob/develop/CHANGELOG.md).

Contributing
------------

[](#contributing)

Please read [CODE\_OF\_CONDUCT.md](https://github.com/10up/safe-redirect-manager/blob/develop/CODE_OF_CONDUCT.md) for details on our code of conduct, [CONTRIBUTING.md](https://github.com/10up/safe-redirect-manager/blob/develop/CONTRIBUTING.md) for details on the process for submitting pull requests to us, and [CREDITS.md](https://github.com/10up/safe-redirect-manager/blob/develop/CREDITS.md) for a listing of maintainers of, contributors to, and libraries used by Safe Redirect Manager.

Like what you see?
------------------

[](#like-what-you-see)

[![Work with the 10up WordPress Practice at Fueled](https://github.com/10up/.github/raw/trunk/profile/10up-github-banner.jpg)](http://10up.com/contact/)

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance69

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor4

4 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~207 days

Recently: every ~98 days

Total

18

Last Release

506d ago

Major Versions

1.11.1 → 2.0.02023-05-31

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1844351?v=4)[Taylor Lovett](/maintainers/tlovett1)[@tlovett1](https://github.com/tlovett1)

---

Top Contributors

[![jeffpaul](https://avatars.githubusercontent.com/u/2818133?v=4)](https://github.com/jeffpaul "jeffpaul (235 commits)")[![tlovett1](https://avatars.githubusercontent.com/u/1844351?v=4)](https://github.com/tlovett1 "tlovett1 (175 commits)")[![iamdharmesh](https://avatars.githubusercontent.com/u/10613171?v=4)](https://github.com/iamdharmesh "iamdharmesh (82 commits)")[![dkotter](https://avatars.githubusercontent.com/u/916738?v=4)](https://github.com/dkotter "dkotter (77 commits)")[![peterwilsoncc](https://avatars.githubusercontent.com/u/519727?v=4)](https://github.com/peterwilsoncc "peterwilsoncc (66 commits)")[![Sidsector9](https://avatars.githubusercontent.com/u/17757960?v=4)](https://github.com/Sidsector9 "Sidsector9 (65 commits)")[![danielbachhuber](https://avatars.githubusercontent.com/u/36432?v=4)](https://github.com/danielbachhuber "danielbachhuber (55 commits)")[![jayedul](https://avatars.githubusercontent.com/u/12506700?v=4)](https://github.com/jayedul "jayedul (44 commits)")[![adamsilverstein](https://avatars.githubusercontent.com/u/2676022?v=4)](https://github.com/adamsilverstein "adamsilverstein (27 commits)")[![dinhtungdu](https://avatars.githubusercontent.com/u/5423135?v=4)](https://github.com/dinhtungdu "dinhtungdu (23 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (19 commits)")[![faisal-alvi](https://avatars.githubusercontent.com/u/25176325?v=4)](https://github.com/faisal-alvi "faisal-alvi (19 commits)")[![helen](https://avatars.githubusercontent.com/u/906334?v=4)](https://github.com/helen "helen (17 commits)")[![bmarshall511](https://avatars.githubusercontent.com/u/1920159?v=4)](https://github.com/bmarshall511 "bmarshall511 (9 commits)")[![ravinderk](https://avatars.githubusercontent.com/u/1784821?v=4)](https://github.com/ravinderk "ravinderk (9 commits)")[![dhanendran](https://avatars.githubusercontent.com/u/6737105?v=4)](https://github.com/dhanendran "dhanendran (8 commits)")[![braders](https://avatars.githubusercontent.com/u/1931323?v=4)](https://github.com/braders "braders (7 commits)")[![tomjn](https://avatars.githubusercontent.com/u/58855?v=4)](https://github.com/tomjn "tomjn (6 commits)")[![benoitchantre](https://avatars.githubusercontent.com/u/1521015?v=4)](https://github.com/benoitchantre "benoitchantre (6 commits)")

---

Tags

http-redirectsmultisite-redirectsredirect-managerredirect-pluginsredirectssafe-http-redirectionurl-redirectionwordpress-plugin

### Embed Badge

![Health badge](/badges/tlovett1-safe-redirect-manager/health.svg)

```
[![Health](https://phpackages.com/badges/tlovett1-safe-redirect-manager/health.svg)](https://phpackages.com/packages/tlovett1-safe-redirect-manager)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.5k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
