子域redirect到HTTPS,尽pipe缺less重写规则

我在staging.example.com上有一个域,我想在没有HTTPS的情况下运行它来进行testing。 主域(example.com)确实使用SSL。

我试图find一个重写规则,将转发到主域的HTTPS,但不是子域名(除www。)。

目前,我已经通过删除所有可以从我的虚拟主机文件find的重写规则进行了testing,并访问了域和子域。 尽pipe为两个虚拟主机文件再次运行a2ensite并运行sudo服务apache2重新加载和sudo服务apache2重新启动,浏览器仍然被redirect到子域和主域上的HTTPS。

这个redirect可能发生在其他地方吗? 这是我的虚拟主机:

<VirtualHost *:80> ServerAdmin [email protected] ServerName example.com ServerAlias www.example.com DocumentRoot /srv/www/example.com/public_html/example/example-production/current/public Options Indexes FollowSymLinks Includes ExecCGI <Directory /srv/www/example.com/public_html/example/example-production/current/public> Allow from all Options -MultiViews -Indexes </Directory> ErrorLog /srv/www/example.com/public_html/example/example-production/current/log/error.log CustomLog /srv/www/example.com/public_html/example/example-production/current/log/access.log combined <Location /> </Location> </VirtualHost> <VirtualHost *:443> ServerName example.com ServerAlias www.example.com DocumentRoot /srv/www/example.com/public_html/example/example-production/current/public ErrorLog /srv/www/example.com/public_html/example/example-production/current/log/error.log SSLEngine On SSLCertificateFile /etc/apache2/ssl/certs/example.com.crt SSLCertificateKeyFile /etc/apache2/ssl/certs/example.com.key SSLCACertificateFile /etc/apache2/ssl/certs/example.com.intermediate.crt SSLOptions +StrictRequire Header set Strict-Transport-Security "max-age=16070400; includeSubDomains" CustomLog /var/log/apache2/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" </VirtualHost> 

和分段子域:

 <VirtualHost *:80> ServerName staging.example.com DocumentRoot /srv/www/example.com/public_html/example/example-staging/current/public <Directory /srv/www/example.com/public_html/example/example-staging/current/public> Allow from all Options -Multiviews </Directory> </VirtualHost> 

 Header set Strict-Transport-Security "max-age=16070400; includeSubDomains" 

您的浏览器正在履行,包括includeSubDomains