Slide 25
Slide 25 text
Ϧ μΠ Ϩ Ϋ τ ͷ ྫ
add_action( 'init', 'redirect_to_spa' );
function redirect_to_spa() {
if ( ! is_user_logged_in() ) {
$uri = $_SERVER[“REQUEST_URI”];
// wp-admin / login / wp-content/ feedҎ֎ϦμΠϨΫτ
if ( ! preg_match( '/^\/wp-login.php/', $uri ) && ! preg_match( '/^\/wp-admin/', $uri ) && ! preg_match( '/
^\/wp-json/', $uri ) && ! preg_match( '/^\/wp-content/', $uri ) && ! preg_match( '/^\/feed/', $uri ) ) {
$url = 'https://wp-kyoto.net' . $uri;
wp_redirect( $url, 301 );
exit();
}
}
}