【问题标题】:How to make changes to this .htaccess to load my site in SSL如何更改此 .htaccess 以在 SSL 中加载我的网站
【发布时间】:2016-11-13 13:16:56
【问题描述】:

我的 .htaccess 文件如下所示

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

最近我安装了 SSL,所以我需要确保我的客户使用 HTTPS 连接到我的网站。那么我需要在此代码中进行哪些更改才能在 SSL 中加载我的网站

【问题讨论】:

    标签: .htaccess mod-rewrite ssl


    【解决方案1】:

    要在 SSL 中加载您的网站,您可以使用

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #http to https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]
    ###########
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    

    【讨论】:

      猜你喜欢
      • 2019-01-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-06-16
      • 1970-01-01
      • 2013-09-02
      相关资源
      最近更新 更多