我试图设置我的网站,以便它有适当的子域名。
例如,如果有人去portfolio.beaudoinapps.com,我希望他们看到我的投资组合页面。
这是我的配置文件:
<VirtualHost *:80>
ServerName www.portfolio.beaudoinapps.com
DocumentRoot /var/www/portfolio
ServerAdmin jonathan@beaudoinapps.com
ErrorLog /var/log/apache2/websites/portfolio-error_log
CustomLog /var/log/apache2/websites/portfolio-access_log common
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
<VirtualHost *:80>
ServerName www.temp.beaudoinapps.com
DocumentRoot /var/www/temp
ServerAdmin jonathan@beaudoinapps.com
ErrorLog /var/log/apache2/websites/temp-error_log
CustomLog /var/log/apache2/websites/temp-access_log common
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /var/www/home
ServerAdmin jonathan@beaudoinapps.com
ErrorLog /var/log/apache2/websites/home-error_log
CustomLog /var/log/apache2/websites/home-access_log common
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
</VirtualHost>
我需要帮助的是如果子域不存在(如果组合不是temp.beaudoinapps或portfolio.beaudoinapps),如何将其重定向到www.beaudoinapps.com
另外,我可以将http流量重定向到https吗?谢谢!