Support » Plugin: Yoast SEO » force canonical scheme

Viewing 1 replies (of 1 total)
  • I added a quick hack to get this resolved;

    function design_canonical() {
    global $post;
    if(isset($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] == “on”) {
    $find = ‘https://www.exampledomain.com’;
    $replace = ”;
    $theurl = str_replace($find,$replace,get_permalink($post->ID));
    return site_url( $theurl , ‘http’ );
    } else {
    // Leave blank and Yoast SEO will use default canonical for posts/pages
    }
    }

    add_filter( ‘wpseo_canonical’, ‘design_canonical’ );

Viewing 1 replies (of 1 total)
  • The topic ‘force canonical scheme’ is closed to new replies.