Redirect only WordPress homepage with a 301 redirect
snippet in htaccess

Redirect only WordPress homepage with a 301 redirect

user7631

function redirect_homepage() {
    if( ! is_home() && ! is_front_page() )
        return;

    wp_redirect( 'http://redirect-here.com', 301 );
    exit;
}

add_action( 'template_redirect', 'redirect_homepage' );

Redirect only WordPress homepage with a 301 redirect

user1441

add_action( 'get_header', 'so16738311_redirect', 0 );
function so16738311_redirect()
{
    if( is_home() || is_front_page() ) {
        wp_redirect( home_url( '/np/' ), 301 );
        exit;
    }
}