Force http canonical tag on https pages
-
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 ) ; }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Force http canonical tag on https pages’ is closed to new replies.