Created
August 18, 2020 20:57
-
-
Save tinjaw/5da8ef61d91b73ca928256bb51200117 to your computer and use it in GitHub Desktop.
A plugin for YOURLS to: Send a 302 (temporary) redirect instead of 301 (permanent) for sites where shortlinks may change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Always-302 Plugin | |
Plugin URI: https://gist.github.com/tinjaw/5da8ef61d91b73ca928256bb51200117 | |
Description: Send a 302 (temporary) redirect instead of 301 (permanent) for sites where shortlinks may change | |
Version: 1.0 | |
Author: Tinjaw | |
Author URI: https://github.com/tinjaw | |
*/ | |
// No direct call | |
if( !defined( 'YOURLS_ABSPATH' ) ) die(); | |
yourls_add_filter( 'redirect_code', 'tinjaw_302_redirection' ); | |
function tinjaw_302_redirection( $code, $location ) { | |
return 302; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment