add_action( 'wp', 'homepage_mobile_redirect' ); function homepage_mobile_redirect() { if ( wp_is_mobile() AND is_front_page() ) { wp_redirect( '/mobileshop/', 301 ); exit; } } -or- if (document.documentElement.clientWidth <760) { window.location = "/webshop"; }