1、首先需要为服务器配置好伪静态(Windows:ISAPI_Rewrite,Linux:mod_rewrite)
2、上传伪静态规则到站点根目录下就可以了。
httpd.ini
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
RewriteCond Host: ^domain\.com$
RewriteRule (.*) http\://www\.domain\.com$1 [RP,I]
.htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]