views:

28

answers:

1

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?

+2  A: 

Try

RewriteCond %{HTTP_HOST} ^xxx\.yyy\.com
RewriteRule (.*) http://zzz.com/$1 [R=permanent,QSA,L]
S.Mark