This is an example of what you can use/do:
<VirtualHost *:80>
DocumentRoot "/var/www/domain.com"
ServerName domain.com
ServerAlias domain.com www.domain.com
<Directory "/path/to/public_html">
allow from all
Options +Indexes
</Directory>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com [NC]
RewriteRule (.*) http://domain.com%{REQUEST_URI} [R=301,L]
</VirtualHost>
The Redirect 301 is good to use but does not have the same flexibility as a rewrite rule.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…