一个月前,我们通过在我们的网站上实施SSL证书,转而使用更安全的协议HTTPS。我们是一家媒体公司并撰写了大量文章,因此我们文章中的分享数量是我们的读者和我们确定内容是否值得阅读/写作的可靠方式。转移到HTTPS后,我们所有的历史份额都更改为" 0" share - 因为所有文章的规范URL都更改为HTTPS - 而这些URL还没有共享。因此,我们从HTTPS实施之日起做了建议并将所有规范URL更改回HTTP,并配置了一个og:ttl标签,告诉Facebot每隔4天刮一次我们的网站。
我们的问题是,自改变规范以来我们已经等了2个星期,但我们的旧文章没有变化。我们可以在调试器中手动搜索一篇文章并修改共享,但是我们10个网站上的绝大部分帖子都没有修复,似乎我们无法做到这一点。 - 这是一个大问题,因为我们还在我们的网站上创建和提供公关文章,但我们无法向客户展示这些文章作为示例,因为他们无法在一个月前看到我们工作中的任何共享。 / p>
我们如何在最短的时间内解决这个问题?
随着越来越多的网站转向HTTPS,这个问题将被提出并且需要一次又一次地回答。
更多信息:
/**
* Check if post was published before SSL was aplied (9th of January 2017) - if yes set canonical url to http not https
*/
function switch_canonicals_before_SSL() {
global $post;
$canonical = get_permalink($post->ID);
// get post write date in Unix timestamp format
$pubDate = get_the_date( $d='U', $post->ID);
// 9th of January in Unix timestamp format
$sslDate = 1484611199;
// $pubDdate < $sslDate
if($pubDate < $sslDate) {
$canonical = str_replace( 'https://www.startitup', 'http://www.startitup', $canonical );
return $canonical;
} else {
return $canonical;
}
}
add_filter( 'wpseo_canonical', 'switch_canonicals_before_SSL' );
/**
* Add og:ttl for Facebot in header
*/
function insert_fb_og_ttl() {
global $post;
if ( !is_singular()) //if it is not a post or a page
return;
echo '<meta property="og:ttl" content="345600"/>';
}
add_action( 'wp_head', 'insert_fb_og_ttl', 5 );
&#13;