我已经用 apache2.4(debian)构建了两个 vhost。
cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName www.hwy.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error_hwy.log
CustomLog ${APACHE_LOG_DIR}/access_hwy.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.test.app
ServerAdmin webmaster@localhost
DocumentRoot /home/debian9/app
ErrorLog ${APACHE_LOG_DIR}/error_hwy.log
CustomLog ${APACHE_LOG_DIR}/access_hwy.log combined
<Directory /home/debian9/app>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
打字www.hwy.local
不会重定向https://www.hwy.local
,打字www.test.app
会重定向https://www.test.app
,为什么?
答案1
根据 Michael Hampton 的说法,www.test.app 的重定向不是来自 apache 配置文件,应用程序的根目录中是否有任何 .htaccess 文件?可以配置重定向!