Created
August 4, 2012 17:16
-
-
Save danielbachhuber/3258825 to your computer and use it in GitHub Desktop.
Revisions
-
danielbachhuber created this gist
Aug 4, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ <?php /** * Quick way to handle redirects for old pages * * From Happiness Bar at WordCamp SF 2012 */ add_action( 'init', 'mea_redirects' ); function mea_redirects() { $mea_redirects = array( // Enter your old URI => new URI '/redundant_digital_control.html' => '/redundant-digital-control/', ); foreach( $mea_redirects as $old_uri => $new_uri ) { if ( false !== strpos( $_SERVER['REQUEST_URI'], $old_uri ) ) { wp_safe_redirect( home_url( $new_uri ), 301 ); exit; } } }