我在Flexible (免费)上使用Cloudflare的SSL,它工作得很好。我已经设置了从https://到//的所有文件和链接,使它们在https上工作。
我还在我的.htaccess文件中设置了以下内容,以使任何客户端自动从http转到https:
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ - [env=askapache:%2].htaccess代码的问题是,它只会在我的站点的根索引文件中将http更改为https。例如,http://example.com/index.php将重定向到https,但http://example.com/folder/index.php不会。
我的第二个问题是,即使我做一个简单的href="https://example.com/folder/index.php"或href="//example.com/folder/index.php",它也只会把我带到基本的http url。
发布于 2015-05-31 02:43:17
如果您使用的是CloudFlare,则可以在页面规则中定义始终使用SSL。
对于.htaccess (递归):
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]https://stackoverflow.com/questions/30549635
复制相似问题