看到這個URL
.htaccess Redirect non-WWW to WWW preserving URI string
或者嘗試
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www.mysite.com [NC]
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
又如
看到這個URL
Codeigniter redirects for a new domain
試試吧
嘗試增加你的的根目錄下面的的.htaccess文件 www.xyz.com網站。
RewriteEngine on
RewriteBase/
#redirect www.xyz.com/A/B/controller/function
#www.xyz.com/B/controller/function
RewriteCond %{HTTP_HOST} ^www\.xyz\.com$ [NC]
RewriteRule ^A/(B/[\w]+/[\w]+)$ /$1 [L,NC,R=301]
#redirect www.xyz.com/A/controller/function to
#www.abc.com/controller/function
RewriteCond %{HTTP_HOST} ^www\.xyz\.com$ [NC]
RewriteRule ^A/([\w]+/[\w]+)$ http://www.abc.com/$1 [L,NC,R=301]
更新您的DNS記錄 – nullpotent