Essentially I need an .htaccess file that will redirect all traffic to our new domain. It need to work in the following conditions:
http://www.olddomain.com/path/file.php => http://www.newdomain.com/path/file.php
https://www.olddomain.com/path/file.php => http://www.newdomain.com/path/file.php
(note in the above case the https redirect to http - this is not an issue)
Also:
http://olddomain.com/path/file.php => http://newdomain.com/path/file.php
https://olddomain.com/path/file.php => http://newdomain.com/path/file.php
I've almost got it working by first redirecting the https version of www.olddomin.com to http version of www.olddomain.com
which then redirects to the http version of the new domain, the problem I have is with the non-www version of https://olddomain.com
which redirects to http://olddomain.com
and then stops.
The code I am using is:
RewriteEngine On
RewriteBase /
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
This almost works except that https://olddomain.com/path/file.php
just redirects to http://olddomain/path/file.php
and stops and doesn't get redirected to http://newdomain.com/path/file.php
Any help would be appreciated.