• Resolved fridha

    (@fridha)


    Some of my pages indexed by Google as https although I’ve setup my sitemap to http only. I need to prevent it and I think canonical could help me with this.

    I’ve found a code from the stackoverflow. Will the code below help me and won’t cause issues with the AIO SEO Pack?

    remove_action ( 'wp_head' , 'rel_canonical' ) ;
    add_action ( 'wp_head' , 'my_rel_canonical' ) ;
    
    function my_rel_canonical () {
        ob_start () ;
        rel_canonical () ;
        $rel_content = ob_get_contents () ;
        ob_end_clean () ;
        echo str_replace ( "https:" , "http:" , $rel_content ) ;
    }

    https://ww.wp.xz.cn/plugins/all-in-one-seo-pack/

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

    (@fridha)

    Forget it,
    Already got the answers my self, force http canonical available in General Settings.

Viewing 1 replies (of 1 total)

The topic ‘Force http canonical tag on https pages’ is closed to new replies.