htaccess redirect https domainA to domainB

Hello, I am trying to redirect domainA to domainB via the following entry in my .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^domainA.com
RewriteRule ^(.*) http://domainB.com/en/ [P]

Open in new window


This works quite well as I thought it did but it does not when a person types into the url https://domainA.com 
Then the customer is not redirected to domainB.com.

What am I missing here ?
Mongoose42Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

btanExec ConsultantCommented:
Maybe something such as where example.com can be your domainA and www.example.com is your domainB. The difference is only on the use of "$ [NC]" meaning appended and no case and for [R=301,L], I see that you use [P] for mod_proxy, maybe we can stick with it..

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

ref - flags https://httpd.apache.org/docs/2.4/rewrite/flags.html
Mongoose42Author Commented:
Thanks for the suggestion but it is not working.  Whenever you surf to https://ourolddomain.com, you are not redirected as if you were to surf to http://ourolddomain.com and then being redirected to http://ournewdomain.com
btanExec ConsultantCommented:
You then need to add probably this too e.g.
RewriteCond %{SERVER_PORT} ^443$ [OR]
RewriteCond %{HTTPS} =on
https://sites.google.com/site/onlyvalidation/page/301-redirect-https-to-http-on-apache-server
Also do ensure you have the server SSL provisiined in the web server.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSL / HTTPS

From novice to tech pro — start learning today.