All Projects → 10up → Safe Redirect Manager

10up / Safe Redirect Manager

Licence: gpl-2.0
A simple HTTP redirection plugin for WordPress.

Projects that are alternatives of or similar to Safe Redirect Manager

404-to-301
Manage 404 errors on your WordPress site and redirect them to any pages using 301 redirect for SEO
Stars: ✭ 11 (-94.53%)
Mutual labels:  wordpress-plugin, redirects
WPCOM-Legacy-Redirector
WordPress plugin for handling large volumes of legacy redirects in a scalable manner.
Stars: ✭ 16 (-92.04%)
Mutual labels:  wordpress-plugin, redirects
hm-redirects
Fast and scalable redirects plugin for WordPress
Stars: ✭ 23 (-88.56%)
Mutual labels:  wordpress-plugin, redirects
Gitium
Keep all your WordPress code on git with a simple plugin and a repo
Stars: ✭ 159 (-20.9%)
Mutual labels:  wordpress-plugin
Wp Graphql Gutenberg
Query gutenberg blocks with wp-graphql
Stars: ✭ 158 (-21.39%)
Mutual labels:  wordpress-plugin
Learnpress
LearnPress WordPress LMS Plugin by ThimPress
Stars: ✭ 173 (-13.93%)
Mutual labels:  wordpress-plugin
Awesome Elementor
A collection of third party add-ons for the Elementor page builder plugin.
Stars: ✭ 201 (+0%)
Mutual labels:  wordpress-plugin
Stackable
Page Builder Blocks for WordPress. An Amazing Block Library for the new WordPress Block Editor (Gutenberg).
Stars: ✭ 151 (-24.88%)
Mutual labels:  wordpress-plugin
Classifai
Enhance your WordPress content with Artificial Intelligence and Machine Learning services.
Stars: ✭ 188 (-6.47%)
Mutual labels:  wordpress-plugin
Nginx Helper
Nginx Helper for WordPress caching, permalinks & efficient file handling in multisite
Stars: ✭ 170 (-15.42%)
Mutual labels:  wordpress-plugin
Wp Multi Network
A network management interface for global multisite administrators
Stars: ✭ 168 (-16.42%)
Mutual labels:  wordpress-plugin
Multisite Global Media
Share a media library across the WordPress Multisite network
Stars: ✭ 162 (-19.4%)
Mutual labels:  wordpress-plugin
Wp Graphql Jwt Authentication
Authentication for WPGraphQL using JWT (JSON Web Tokens)
Stars: ✭ 172 (-14.43%)
Mutual labels:  wordpress-plugin
Pop
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Stars: ✭ 160 (-20.4%)
Mutual labels:  wordpress-plugin
Syntaxhighlighter
WordPress plugin that makes it easy to post syntax-highlighted code snippets.
Stars: ✭ 194 (-3.48%)
Mutual labels:  wordpress-plugin
Wp Document Revisions
A document management and version control plugin that allows teams of any size to collaboratively edit files and manage their workflow.
Stars: ✭ 152 (-24.38%)
Mutual labels:  wordpress-plugin
Gcf
Gutenberg Custom Fields... wait what?
Stars: ✭ 185 (-7.96%)
Mutual labels:  wordpress-plugin
Woo Poly Integration
Looking for maintainers! - Wordpress WooCommerce Polylang Integration
Stars: ✭ 168 (-16.42%)
Mutual labels:  wordpress-plugin
Accelerated Mobile Pages
Automatically add Accelerated Mobile Pages (AMP Project) functionality on your WordPress.
Stars: ✭ 167 (-16.92%)
Mutual labels:  wordpress-plugin
Retour
DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Stars: ✭ 172 (-14.43%)
Mutual labels:  redirects

Safe Redirect Manager

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

Support Level Build Status Release Version WordPress tested up to version GPLv2 License

Purpose

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.

Installation

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").

Configuration

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:

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

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 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:

  • 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 250 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.

Filters

Redirect loops detection

By default redirect loop detection is disabled. To prevent redirect loops you can filter srm_check_for_possible_redirect_loops.

add_filter( 'srm_check_for_possible_redirect_loops', '__return_true' );

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

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 <from> <to> [<status-code>] [<enable-regex>] [<post-status>]

    Create a redirect. <from> and <to> are required parameters.

    • <from>: Redirect from path. Required.

    • <to>: Redirect to path. Required.

    • <status-code>: HTTP Status Code. Optional. Default to 302.

    • <enable-regex>: Whether to enable Regular expression. Optional. Default to false.

    • <post-status>: 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 <id>

    Delete a redirect by <id>.

  • wp safe-redirect-manager update-cache

    Update the redirect cache.

  • wp safe-redirect-manager import <file> [--source=<source-column>] [--target=<target-column>] [--regex=<regex-column>] [--code=<code-column>] [--order=<order-column>]

    Imports redirects from a CSV file.

    • <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:

      source target regex code order
      /legacy-url /new-url 0 301 0
      /category-1 /new-category-slug 0 302 1
      /tes?t/[0-9]+/path/[^/]+/? /go/here 1 302 3
      ... ... ... ... ...

      You can also use exported redirects from "Redirection" plugin, which you can download here: /wp-admin/tools.php?page=redirection.php&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 <file>

    Import .htaccess file redirects.

Development

Setup

Follow the configuration instructions above to setup the plugin. We recommend developing the plugin locally in an environment such as WP Local Docker.

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

Issues

If you identify any errors or have an idea for improving the plugin, please open an issue.

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. Many thanks to the contributors on the translation teams!

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Changelog

A complete listing of all notable changes to Safe Redirect Manager are documented in CHANGELOG.md.

Contributing

Please read CODE_OF_CONDUCT.md for details on our code of conduct, CONTRIBUTING.md for details on the process for submitting pull requests to us, and CREDITS.md for a listing of maintainers of, contributors to, and libraries used by Safe Redirect Manager.

Like what you see?

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].