【问题标题】:Https and htaccessHttps 和 htaccess
【发布时间】:2015-10-07 14:02:05
【问题描述】:

我正在尝试将所有 http url 重定向到 https。 我正在苦苦挣扎,因为我需要在此处保留当前的重定向:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.html?user=$1 [L,QSA]

您能帮我修改此代码以包含 de https 重定向吗?谢谢

【问题讨论】:

    标签: .htaccess mod-rewrite https url-redirection


    【解决方案1】:

    使用以下规则:

    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.html?user=$1 [L,QSA]
    

    【讨论】:

      猜你喜欢
      • 2013-01-11
      • 2015-11-23
      • 2017-07-15
      • 2012-02-02
      • 2016-04-05
      • 2020-10-02
      • 2021-01-30
      • 1970-01-01
      • 2016-03-10
      相关资源
      最近更新 更多