开发者

How do I replace the domain name in a Apache Rewrite rule?

I need to redirect a URL domain.com to domain.net in a Rewri开发者_StackOverflowte rule. I originally used redirect, but it lost the POST variables I was sending. Will a Rewrite carry them over and what is the best way to do this?


This should resolve your problem:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain.com$
RewriteRule ^(.*)$ http://www.thenewdomain.net/$1 [R=301,L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜