我有以下内容:
<VirtualHost *:80>
DocumentRoot /var/www/webmaster/example.com/web
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@example.com
<Directory /var/www/webmaster/example.com/web>
Options +ExecCGI
AllowOverride All
Require all granted
</Directory>
RewriteCond %{HTTP_HOST} ^example.com [NC]
RewriteRule ^(.*) http://www.example.com$1 [last,redirect=301]
</VirtualHost>
但是当我查看http://example.com时,它会停留在http://example而不会转到http://www.example.com
即使尝试了所有其他提及的帖子,例如:apache redirect from non www to www
,也是如此