![Virtualmin/Apache 和重定向](https://linux22.com/image/1585203/Virtualmin%2FApache%20%E5%92%8C%E9%87%8D%E5%AE%9A%E5%90%91.png)
我正在运行 Virtualmin 并向系统添加了一个网站。但是,我可能在运行它时遇到了问题。
如果我访问 website.com,它会将我重定向到默认 website.com。但是,如果我访问 www.website.com,我会正确访问该网站。
这是我的网站的 .conf 文件,但我认为 Apache 中其他地方的配置一定会导致此重定向。我在任何其他虚拟服务器上都没有遇到问题。
<VirtualHost *:80>
SuexecUserGroup #1020 #1018
ServerName website.com
ServerAlias www.website.com
ServerAlias webmail.website.com
ServerAlias admin.website.com
DocumentRoot /home/website/public_html
ErrorLog /var/log/virtualmin/website.com_error_log
CustomLog /var/log/virtualmin/website.com_access_log combined
ScriptAlias /cgi-bin/ /home/website/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/website/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php7.0 .php7.0
AddType application/x-httpd-php .php
</Directory>
<Directory /home/website/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.website.com
RewriteRule ^(.*) https://website.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.website.com
RewriteRule ^(.*) https://website.com:10000/ [R]
</VirtualHost>