将我的所有网站重定向到https?

时间:2015-06-29 18:41:37

标签: apache .htaccess

我在BUILD FAILED... ...defaultCacheDir must be absolute: ${env.WORKSPACE}/.ivy2/cache中使用了以下内容,因此当用户进入我网站的主页时,会被迫加载.httpaccess

https

我想知道如何修改此内容,以便发生在我网站的每一页上,例如,如果我加载RewriteEngine On RewriteCond %{SERVER_PORT} !=443 RewriteCond %{HTTP_HOST} ^(www\.)?ka**\.com$ [NC] RewriteRule ^$ https://www.ka**.com/%{REQUEST_URI} [R,L] ,则会强制加载http://ka**.com/****/myfile.json。< / p>

感谢。

2 个答案:

答案 0 :(得分:0)

请勿限制仅作为着陆页的规则^$

RewriteEngine On

RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

答案 1 :(得分:0)

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]