Redirect component for Mercator.

Installs: 10 169

Dependents: 0

Suggesters: 0

Security: 0

Stars: 15

Watchers: 28

Forks: 11

Open Issues: 4


0.1.0 2018-12-04 17:07 UTC

This package is auto-updated.

Last update: 2024-05-28 12:35:55 UTC


Redirect component for Mercator.

Redirects to the domain listed in the wp_blogs table. With newer versions of Mercator this should be treated as the primary domain.

The addon also supports redirecting to aliases for legacy data.


Mercator requires WordPress 3.9 or newer for the new sunrise processes. Mercator also requires PHP 5.3+ due to the use of namespaced code.


Include the file redirect.php from your sunrise.php in the same way you include Mercator itself.

For example:

// Default mu-plugins directory if you haven't set it
defined( 'WPMU_PLUGIN_DIR' ) or define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' );

require WPMU_PLUGIN_DIR . '/mercator/mercator.php';
require WPMU_PLUGIN_DIR . '/mercator-redirect/redirect.php';


You can modify SSO behaviour for example in a local environment with the following filters in sunrise.php:


Defaults to true

// Disable redirects
add_filter( 'mercator.redirect.enabled', '__return_false' );


Defaults to false

// Enable redirecting the admin
add_filter( 'mercator.redirect.admin.enabled', '__return_true' );


Defaults to false

// Enable legacy redirects
add_filter( 'mercator.redirect.legacy.enabled', '__return_true' );


Defaults to 301

// Change http redirect from 301 to 302.
add_filter( 'mercator.redirect.status.code', function() { return 302; } );


Mercator is licensed under the GPLv3 or later.


Created by Human Made for high volume and large-scale sites, such as Happytables. We run Mercator on sites with millions of monthly page views, and thousands of sites.

Written and maintained by Ryan McCue. Thanks to all our contributors.

Mercator builds on concepts from WPMU Domain Mapping, written by Donncha O'Caoimh, Ron Rennick, and contributors.

Mercator relies on WordPress core, building on core functionality added in WP27003. Thanks to all involved in the overhaul, including Andrew Nacin and Jeremy Felt.

Interested in joining in on the fun? Join us, and become human!