从HTTP切换到HTTPS,失去了所有的Facebook"喜欢" [英] Switching from HTTP to HTTPS, lost all Facebook "Likes"

查看:197
本文介绍了从HTTP切换到HTTPS,失去了所有的Facebook"喜欢"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

切换到https后://,我们所有的文章都失去了自己的Facebook的Like计数。所以我想禁用HTTPS只为我们的网站,这是在/content.php的内容区(文章是在content.php的形式?212-MY-文章)

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 /content.php (articles are in the form of content.php?212-My-Article)

我目前的.htaccess:

My current .htaccess:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

我需要什么补充,以重定向所有content.php *流量HTTP(非安全),即使他们输入https开头

What do I need to add, in order to redirect all content.php* traffic to http (non-secure), even if they type "https"

谢谢!

推荐答案

您将需要作出改变,以你的第一个规则,排除 content.php 。在您只需添加对 content.php 的规则,会做你的其他规则完全相反。您可以添加 [R = 301] 标志,如果你的规则做你希望他们做的,把它们变成永久重定向是什么。永久重定向由浏览器高速缓存,并会减少进行到服务器的请求的量。你并不需要使用捕获组为您的第一个规则,所以我只是用 ^ 语法,每一个请求相匹配。

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}

这篇关于从HTTP切换到HTTPS,失去了所有的Facebook"喜欢"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆