apache_conf .htaccess强制https

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf .htaccess强制https相关的知识,希望对你有一定的参考价值。

# -----------------------Force https----------------------------------------------------------
RewriteEngine On
# This will enable the Rewrite capabilities

RewriteOptions InheritDownBefore
# This prevents the rule from being overrided by .htaccess files in subdirectories.

RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS

RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [QSA,R,L]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e.  http://www.example.com/foo/ to https://www.example.com/foo/
# ----------------------\Force https----------------------------------------------------------

以上是关于apache_conf .htaccess强制https的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf 使用.htaccess强制HTTPS

apache_conf 强制www。 (htaccess的)

apache_conf 使用.htaccess强制下载文件

apache_conf 如何使用.htaccess文件强制HTTPS

apache_conf .htaccess - 强制文件在浏览器中下载

apache_conf 示例htaccess规则强制通过HTTPS的所有流量