How to take over Facebook and Hateb when redirecting from http to https!

How to take over Facebook and Hateb when redirecting from http to https!

If you redirect from http to https when SSL is always introduced, Facebook likes and Hatena bookmarks will return to zero as the URL changes. I will show you how to take over this.

Facebook

Although it is also posted on Facebook’s official website , change og: url to “http: // ~” and exclude https: // redirects from http: // only for Facebook crawlers.Set HTML og: url to http: // ~<meta property = “og: url” content = “http://example.com/”>Edit .htaccess<IfModule mod_rewrite.c> RewriteEngine on RewriteCond% {HTTP_USER_AGENT}! (Facebot | facebookexternalhit / 1.1) [NC] RewriteCond% {HTTPS} off RewriteRule ^ (. * $) Https://knowledge.cpi.ad.jp/$1 [R = 301, L] </ IfModule> The third line is a description that excludes Facebook crawlers, otherwise it is a method to redirect http: // ~ to https: // ~.

Confirmation method

Use Facebook Debuger to debug. As shown below, if the Input URL is “https” and the og: url is “http”, the setting is complete.If it does not change, click the “Scrape Again” button.

Hatena Bookmark

For Hatena bookmarks, from the button creation page, set the URL to save to the “http: //” address and set it on the site.