wordpress 404 redirect to other url

wordpress 404 redirect to other url

If you are using wordpress as blog of your website blog and you are using other cms as your main website now you want any 404 of wordpress blog will redirect to that other cms 404 page then you use below code example to redirect your wordpress blog 404 page.

add_action('wp','determine_if_fourzerofour_page');
function determine_if_fourzerofour_page(&$arr){
    global $wp_query;    
    if($wp_query->is_404){        
        $url_redirect = 'http://www.exampledomain.com/404.php';        
        header('Location: '.$url_redirect);
        die;
    }
}

Leave a Reply

  • (will not be published)