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]
精彩评论