Forum Moderators: phranque
www.domain1.com goes to www.domain2.com
domain1.com goes to www.domain2.com
but
www.domain1.com/contact/ stays at www.domain1.com/contact/
What am I missing?
This rule specifically says that you only want to forward requests for "/" to the new domain, because you have end-anchored the RewriteRule pattern. It also says that this redirect is temporary, and that you want to process more RewriteRules after this one. And finally, you did not capture the requested "file", leaving back-reference $1 undefined, so all requests to domain1 (including those for images, css stylesheets, etc.) will be redirected to the home page of domain2.
RewriteRule ^/(.*) http://www.domain2.com/$1 [R=301,L]
RewriteRule (.*) http://www.domain2.com/$1 [R=301,L]
See our forum charter [webmasterworld.com] for some useful references on mod_rewrite and regular expressions.
Jim