开发者

How can I redirect all traffic from one domain to another with an .htaccess file?

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜