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]
|