Redirect Main Site
-
I have a multisite installation but have no need for the main site. What I would like is for any public url’s on the main site to be redirected (301) to another site completely. However, I need the main site admin to remain accessible. I have tried this in my main site themes functions file;
function redirect_entire_site() { if( strpos( $_SERVER['REQUEST_URI'], '/wp-admin' ) === false || strpos( $_SERVER['REQUEST_URI'], '/wp-login' ) === false ) { wp_redirect( 'https://new-domain.com/my-page/', 301 ); exit; } } add_action( 'init', 'redirect_entire_site' );
However it redirects everything, regardless of the current URI.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Redirect Main Site’ is closed to new replies.