Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter sukezane

    (@sukezane)

    I solved this issue. I just removed base path from redirect domain and restrict access by multiple_domain_redirect action hook to make custom redirect function.

    function multiple_domain_redirect_movie($domain)
    {
        if ($domain === MULTPLE_DOMAIN_ORIGINAL_DOMAIN) {
            return;
        }
        
        if (!empty($_SERVER['REQUEST_URI']) && !preg_match('/^\/(netflix|hulu)/i', $_SERVER['REQUEST_URI'])) {
            $protocol = empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] === 'off' ? 'http' : 'https';
            wp_redirect( $protocol . '://' . MULTPLE_DOMAIN_ORIGINAL_DOMAIN . $_SERVER['REQUEST_URI']);
            exit;
        }
    }
    
    add_action('multiple_domain_redirect', 'multiple_domain_redirect_movie');
Viewing 1 replies (of 1 total)