humanmade/Mercator-Redirect

Name: Mercator-Redirect

Owner: Human Made

Description: Redirect handler for mapped domains

Created: 2016-09-20 14:35:14.0

Updated: 2018-05-15 14:50:45.0

Pushed: 2018-03-14 15:59:18.0

Homepage: null

Size: 20

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Mercator Redirect

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.

Requirements

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.

Installation

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

For example:

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

ire WPMU_PLUGIN_DIR . '/mercator/mercator.php';
ire WPMU_PLUGIN_DIR . '/mercator-redirect/redirect.php';
Filters

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

mercator.redirect.enabled

Defaults to true

isable redirects
filter( 'mercator.redirect.enabled', '__return_false' );

mercator.redirect.admin.enabled

Defaults to false

nable redirecting the admin
filter( 'mercator.redirect.admin.enabled', '__return_true' );

mercator.redirect.legacy.enabled

Defaults to false

nable legacy redirects
filter( 'mercator.redirect.legacy.enabled', '__return_true' );

mercator.redirect.status.code

Defaults to 301

hange http redirect from 301 to 302.
filter( 'mercator.redirect.status.code', function() { return 302; } );
License

Mercator is licensed under the GPLv3 or later.

Credits

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!


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.