添加尾部斜杠后,Apache 将子域名重定向到 HTTP

添加尾部斜杠后,Apache 将子域名重定向到 HTTP

我根据新信息编辑了这个问题。

我知道我对服务器配置还很陌生。

我注意到 mod_dir 在所有非子域路径中正确添加了反斜杠。

例如:https://example.co/test => https://example.co/test/

但是当我有一个子域名时:https://sub.example.co/test => http://sub.example:443/test/

在此处输入图片描述

这是我的默认 SSL

 ExpiresActive On
 ExpiresDefault "access plus 1 month"
 Protocols h2 h2c http/1.1
 Alias "/library/" "/var/www/html/example/library/"
 <Directory /var/www/html/>
  Options FollowSymLinks MultiViews
  AllowOverride All
  Order allow,deny
  allow from all
 </Directory>
 <FilesMatch "\.(cgi|shtml|phtml|php)$">
  SSLOptions +StdEnvVars
 </FilesMatch>
 <Directory /usr/lib/cgi-bin>
  SSLOptions +StdEnvVars
 </Directory>
 <VirtualHost _default_:443>
  ServerName example.co
  DocumentRoot /var/www/html/example
  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/example.co/cert.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.co/privkey.pem
  SSLCertificateChainFile /etc/letsencrypt/live/example.co/chain.pem
 </VirtualHost>
 <VirtualHost *:443>
  ServerAlias sub.*
  DocumentRoot /var/www/html/example/sub
 </VirtualHost>

这是我的000-默认

<VirtualHost *:80>
 RewriteEngine On
 RewriteCond %{HTTPS} off
 RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>

为什么当 mod_dir 添加目录斜杠时,我的子域名会抛出错误并变成 HTTP?

相关内容