4

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?

Nathan Osman
  • 71,149
  • 71
  • 256
  • 361

1 Answers1

4

Try

RewriteCond %{HTTP_HOST} ^xxx\.yyy\.com
RewriteRule (.*) http://zzz.com/$1 [R=permanent,QSA,L]
YOU
  • 120,166
  • 34
  • 186
  • 219
  • If this does not work at first, try changing the apache.conf (on linux: /etc/httpd/conf/httpd.conf ) setting `AllowOverride None` to `AllowOverride All` inside the `` configuration. Then restart apache ( on linux: /etc/init.d/httpd restart ) – T. Brian Jones Sep 27 '11 at 10:19