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

前端 未结 4 1604
我在风中等你
我在风中等你 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 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}
    

提交回复
热议问题