源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

apache设置自动将http跳转到https的方法

  • 时间:2021-04-15 00:34 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:apache设置自动将http跳转到https的方法
[u]复制代码[/u] 代码如下:
<Directory "/opt/fivetrees"> # # Possible values for the Options directive are "None", "All", # or any combination of: #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important.  Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options FollowSymLinks # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: #   Options FileInfo AuthConfig Limit # AllowOverride All #这里原先是None要改为All # # Controls who can get stuff from this server. # Order allow,deny Allow from all </Directory>
首先,在网站根目录下创建.htaccess文件,在最下面添加写入如下语句:
[u]复制代码[/u] 代码如下:
RewriteEngine on RewriteBase / #我这行是没有配置 RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部