1 | <?php |
---|
2 | |
---|
3 | function my_no_blog_redirect( $domain, $blogname, $current_site, $current_blog, $path ) { |
---|
4 | |
---|
5 | // If we are here then a valid blog hasn't been found for this request |
---|
6 | |
---|
7 | // Perform our own checking to see if we need to do a 301 redirect from the requested domain to another domain |
---|
8 | $domain_redirect = domain_redirect_location_lookup( $domain, $blogname, $current_site, $current_blog, $path ); |
---|
9 | |
---|
10 | if ($domain_redirect) { |
---|
11 | header( "HTTP/1.1 301 Moved Permanently" ); |
---|
12 | header( "Location: http://{$domain_redirect}{$_SERVER['REQUEST_URI']}" ); |
---|
13 | exit; |
---|
14 | } |
---|
15 | // Otherwise WordPress will fall back to using the NOBLOGREDIRECT constant |
---|
16 | } |
---|
17 | add_action('no_blog_redirect', 'my_no_blog_redirect', 10, 5 ); |
---|