Link to home
Start Free TrialLog in
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 ?
Avatar of btan
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
Avatar of 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
Avatar of btan
btan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial