PHP code example of humanmade / mercator-redirect

1. Go to this page and download the library: Download humanmade/mercator-redirect library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

humanmade / mercator-redirect example snippets



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


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

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

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

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