子域重定向到 www
Subdomain redirecting to www
我在我的 apache 配置中为一个子域设置了两个虚拟主机。一种用于 SSL,另一种用于非 SSL 重定向到 SSL。就是这样:
<VirtualHost *:80>
ServerName subdomain.domain.tld
Redirect permanent / https://subdomain.domain.tld/
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/var/www/subdomain"
ServerName subdomain.domain.de
<Directory "/var/www/subdomain">
AllowOverride All
allow from all
Options +Indexes
</Directory>
SSLCertificateFile /etc/letsencrypt/live/subdomain.domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/subdomain.domain.tld/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
显然我也使用 Let's Encrypt。
DNS设置如下:
subdomain.domain.tld IN A <IP address of server>
问题是,在我的浏览器中对 subdomain.domain.tld 的任何请求最终都会重定向到 https://www.subdomain.domain.tld。
该设置甚至不包括对 www 的任何请求。
为什么将我的请求重定向到 www?这是我想避免的。
我发现了问题。
它与 apache 配置无关,而是托管的 worpress 实例执行了 301 重定向。
对不起。
我在我的 apache 配置中为一个子域设置了两个虚拟主机。一种用于 SSL,另一种用于非 SSL 重定向到 SSL。就是这样:
<VirtualHost *:80>
ServerName subdomain.domain.tld
Redirect permanent / https://subdomain.domain.tld/
</VirtualHost>
<VirtualHost *:443>
DocumentRoot "/var/www/subdomain"
ServerName subdomain.domain.de
<Directory "/var/www/subdomain">
AllowOverride All
allow from all
Options +Indexes
</Directory>
SSLCertificateFile /etc/letsencrypt/live/subdomain.domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/subdomain.domain.tld/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
显然我也使用 Let's Encrypt。
DNS设置如下:
subdomain.domain.tld IN A <IP address of server>
问题是,在我的浏览器中对 subdomain.domain.tld 的任何请求最终都会重定向到 https://www.subdomain.domain.tld。
该设置甚至不包括对 www 的任何请求。
为什么将我的请求重定向到 www?这是我想避免的。
我发现了问题。
它与 apache 配置无关,而是托管的 worpress 实例执行了 301 重定向。
对不起。