Switching from HTTP to HTTPS, lost all Facebook “Likes”

前端 未结 4 1504
我在风中等你
我在风中等你 2021-01-25 17:42

After switching to https://, all of our articles have lost their Facebook \"Like\" count. So I would like to disable https just for the Content area of our website, which is at

相关标签:
4条回答
  • 2021-01-25 17:51

    I found a way to fix this, without making content.php be unsecure. The Facebook "Like" HTML code looks like this:

    <fb:like href="https://www.mysite.com/{vb:raw relpath}" font="tahoma" layout="standard" show_faces="false" width="260" action="like" colorscheme="light"></fb:like>
    

    I use vBulletin. I changed it to http, and everything is fine now!

    0 讨论(0)
  • 2021-01-25 17:55

    You can use this code:

    RewriteEngine on
    
    # uri is not /content.php
    RewriteCond %{REQUEST_URI} !^/content\.php$ [NC]
    # https is off
    RewriteCond %{HTTPS} off
    # redirec to https site
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    0 讨论(0)
  • 2021-01-25 18:00

    There is a very easy solution: with the og:url meta tag:

    <meta property="og:url" content="http://example.com/old-url" />
    

    You can read more about that into the FAQ section: https://developers.facebook.com/docs/plugins/faqs

    The section is called: How do I move a page to a different URL?

    0 讨论(0)
  • 2021-01-25 18:13

    You'll need to make a change to your first rule to exclude content.php. The you simply add a rule for content.php that will do exactly the opposite of your other rule. You can add the [R=301] flag if your rules do what you expect them to do to turn them into permanent redirects. Permanent redirects are cached by the browser and will reduce the amount of requests done to your server. You don't need to use a capturing group for your first rule, and therefore I just used the ^ syntax, which matches every request.

    RewriteEngine on
    
    #Turn the entire site into https, except for content.php
    RewriteCond %{HTTPS} off
    RewriteCond %{REQUEST_URI} !^/content\.php$
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
    
    #Use http instead for this url
    RewriteCond %{HTTPS} on
    RewriteCond ^content\.php$ http://%{HTTP_HOST}%{REQUEST_URI}
    
    0 讨论(0)
提交回复
热议问题