在httpd.conf里添加如下内容:
<VirtualHost *:80>
DocumentRoot "/var/www/html"#域名绑定的目录
ServerName piaocoder.com
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^piaocoder.com [NC]
RewriteRule ^/(.*)$ http://www.piaocoder.com/$1 [L,R=301]
</ifModule>
ErrorLog "logs/piaocoder.com-error_log"
CustomLog "logs/piaocoder.com-access_log" common
</VirtualHost>
#以上piaocoder.com替换成相应的域名即可