如何在apache中将子域重定向到https主域
我有一些网站示例.biz。我将所有http请求重定向到https,但如何重定向子域(包括位于不同配置文件中的一个主机)?我需要这样的东西:如果我写bla-bla.example.biz,我必须重定向到example.biz。但是如果ololo.bla-bla.example.biz-错误。所有这些重定向都必须是https。除此之外,我无法将*.example.biz添加到ServerAlias,因为我有另一个站点adm.example.biz。现在,如果我写一些类似于any.example.biz的东西,我会留在主页上 example.com的配置:如何在apache中将子域重定向到https主域,apache,.htaccess,redirect,Apache,.htaccess,Redirect,我有一些网站示例.biz。我将所有http请求重定向到https,但如何重定向子域(包括位于不同配置文件中的一个主机)?我需要这样的东西:如果我写bla-bla.example.biz,我必须重定向到example.biz。但是如果ololo.bla-bla.example.biz-错误。所有这些重定向都必须是https。除此之外,我无法将*.example.biz添加到ServerAlias,因为我有另一个站点adm.example.biz。现在,如果我写一些类似于any.example.bi
<VirtualHost *:80>
ServerAdmin i@example.com
ServerName example.biz
ServerAlias www.example.biz
UseCanonicalName On
DocumentRoot /var/www/example/webapps
LogLevel warn
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
ErrorLog ${APACHE_LOG_DIR}/example-error.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
</VirtualHost>
https配置:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin i@example.com
ServerName example.biz
ServerAlias www.example.biz
UseCanonicalName On
DocumentRoot /var/www/example/webapps/
LogLevel warn
ErrorLog ${APACHE_LOG_DIR}/example-error.log
CustomLog ${APACHE_LOG_DIR}/example-access.log combined
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/rockfutur/webapps/rockfutur/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
SSLEngine on
SSLCertificateFile /etc/ssl/certs/example.pem
SSLCertificateKeyFile /etc/ssl/private/example.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
# MSIE 7 and newer should be able to use keepalive
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
</VirtualHost>
</IfModule>