Служба роботи з клієнтами Розрахунки з клієнтами:

понеділок — п’ятниця:
9:00 - 18:00 Центральноєвропейський час

Технічна підтримка:

понеділок — п’ятниця:
9:00 - 18:00 Центральноєвропейський час

Обробка замовлень / видавання сертифікатів:

24/7

Запитуєте — відповідаємо!

How to restore Facebook likes and reposts after switching to HTTPS

How to restore Facebook likes and reposts after switching to HTTPS

Transition from HTTP to HTTPS is a legitimate and reasonable process in recent years, which is allow following with best practices of the industry and protecting sensitive visitors data. However, moving to HTTPS may not go smoothly. For example, when switching to HTTPS, site owners may find that some of their likes and reposts on Facebook were lost.

The 301 redirect, which is usually specified in .htaccess and allows you to save hits on Google Analytics, not work concerning Facebook. HTTPS and HTTP links in social networks are different; therefore, statistics on social interaction could be lost. There are common topics raised throughout the web related to such a loss of stats. How to recover Facebook likes and reposts? Is there any specific method for restoring social activity indicators?

Yes, this method exists, and we would like to review it below.

Step 1. First, we need to go to Tools & Support in the developer's Facebook interface, then select the Sharing Debugger tab. Here we can enter the URL and get statistics on how many times users shared it on Facebook.

Step 2. We would need to reset social indicators. After entering the URL in the Sharing Debugger, you will see a button with inscription "Scrape Again". Clicking on it will reset the data. We would do it.

Step 3. Make preferred version of the URL with HTTP for Facebook robots by using following attribute rel = "canonical". Example: <link rel = "canonical" href = "http://example.com/example-article" />. A link with HTTP must be specified as canonical in the Facebook interface.

Note: this technique is only applicable for older pages that are accessible via http. For the new pages, you must specify a link with HTTPS as the canonical URL.

Step 4. Identify Facebook robot by using user-agent or IP-address. The robot will be passed a URL with HTTP for old articles and URLs with HTTPS for new articles, which will allow to correctly displaying social indicators.

Here's the code to identify Facebook robot:

PHP:

if(preg_match('/facebookexternalhit/i',$_SERVER['HTTP_USER_AGENT'])) {

echo '<link rel="canonical" href="http://url-s-http">';

} else {

echo '<link rel="canonical" href="https://url-s-https">';

}

Nginx

if ($HTTP_USER_AGENT ~ "^((?!facebookexternalhit).)*$") {

return 301 https://vash-adres-saita$request_uri;

}

This method will help to avoid loss of social indicators in Facebook due to transition from HTTP to HTTPS.


Досі маєте запитання? Напишіть нам!

Погоджуюся

Вводячи свою електронну пошту, ви підтверджуєте, що прочитали та прийняли умови користування сайтом Умови користування, Політику конфіденційності та Політику відшкодування.

>