.htaccess redirect all pages to new domain
The below answer could potentially cause an infinite redirect loop...
Here, this one redirects everything after the domain name on the URL to the exact same copy on the new domain URL:
RewriteEngine on
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
www.example.net/somepage.html?var=foo
redirects to:
www.newdomain.com/somepage.html?var=foo
May be like this:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^OLDDOMAIN\.com$ [NC]
RewriteRule ^(.*)$ http://NEWDOMAIN.com [R=301,L]
Just to clarify, after removing the hosting redirect which was in the way, my original solution also works:
RewriteEngine On
RewriteRule ^(.*)$ http://newdomain.com/ [R=301]