Avatar of Mongoose42
Mongoose42
 asked on

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 ?
SSL / HTTPSHTTP Protocol

Avatar of undefined
Last Comment
btan

8/22/2022 - Mon
btan

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
Mongoose42

ASKER
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
ASKER CERTIFIED SOLUTION
btan

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes