【问题标题】:Missing redirection to HTTPS缺少到 HTTPS 的重定向
【发布时间】:2021-01-22 14:13:52
【问题描述】:

我在我的 LAMP SSL 证书上安装了 Let´s encrypt。我想通过 HTTPS 重定向我的所有域。 现在它的工作,但不完全。

http://domain.name 重定向到 https://domain.name(证书有效)
http://www.domain.name 不重定向到 https://,而是直接重定向到 https://www.domain.name(证书有效)

这是我的 .htaccess 文件

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]

【问题讨论】:

    标签: ubuntu ssl apache2


    【解决方案1】:

    我解决了这个线程的问题 https://stackoverflow.com/a/3869287/8341397

    我在/etc/apache2/apache2.conf中设置

    <Directory />
        Options FollowSymLinks
        AllowOverride All
        Require all denied
    </Directory>
    
    <Directory /usr/share>
        AllowOverride All
        Require all granted
    </Directory>
    
    <Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    
    

    All AllowOverride 从 None 到 All 并重启 Apache2-Service

    【讨论】:

      猜你喜欢
      • 2019-01-21
      • 1970-01-01
      • 1970-01-01
      • 2020-04-17
      • 1970-01-01
      • 1970-01-01
      • 2011-08-18
      • 1970-01-01
      • 2020-09-11
      相关资源
      最近更新 更多