Last active
August 29, 2015 14:19
-
-
Save mojowen/e7f3727b1ffbdf480aa4 to your computer and use it in GitHub Desktop.
Redirect WordPress to Subfolder from Non-Base Domain
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 | |
// Redirects brooklynkindershule.org to campkinderland.org/shule and respects sub paths | |
function custom_rewrite_basic() { | |
if( $_SERVER['SERVER_NAME'] == 'brooklynkindershule.org') { | |
$location = 'http://campkinderland.org/shule'; | |
if( $_SERVER['REQUEST_URI'] && $_SERVER['REQUEST_URI'] != '/shule' ) $location .= '/'.$_SERVER['REQUEST_URI']; | |
header( 'Location: '.$location ); | |
} | |
} | |
add_action('template_redirect', 'custom_rewrite_basic'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment