Say I have a subdomain xxx.yyy.com
running Apache. The files are stored in /home/someone/public_html/xxx
.
What I want to do is redirect all requests to a domain name zzz.com
which is using the same location for its files. (In other words, xxx.yyy.com
and zzz.com
are aliases for each other)
I just want people accessing zzz.com
, so if someone goes to xxx.yyy.com
they should be redirected to 开发者_高级运维zzz.com
.
Can this easily be done with a rewrite rule in an .htaccess file?
Try
RewriteCond %{HTTP_HOST} ^xxx\.yyy\.com
RewriteRule (.*) http://zzz.com/$1 [R=permanent,QSA,L]
精彩评论