This code in .htaccess does redirect all requests to a new domain:
RewriteEngine On
RewriteRule ^(.*)$ http://WWW.NEW-DOMAIN.COM/ [R=301]
The problem was, all other directives work like:
www.old-domain.com/bla -> www.new-domain.com/bla
but I need
www.old-domain.com/bla -> www.new-domain.com
www.old-domain.com/more/bla -> www.new-domain.com
So the htaccess code above works fine.
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} =on
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<Files .htaccess>
order allow,deny
deny from all
</Files>
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
<Files .htaccess>
order allow,deny
deny from all
</Files>