看到这个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