Forum Moderators: phranque
I'm having a problem redirecting https pages and would really appreciate your help.
I'm redirecting all pages from domainA.com to domainB.com. Right now regular pages redirect fine using:
RewriteCond %{HTTP_HOST} ^domainA\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domainA\.com$
RewriteRule ^(.*)$ [domainB.com...] [R=301,L]
I have tried the following solutions to redirect https pages but they have not worked:
RewriteCond %{HTTPS_HOST} ^domainA\.com$ [OR]
RewriteCond %{HTTPS_HOST} ^www\.domainA\.com$
RewriteRule ^(.*)$ [domainB.com...] [R=301,L]
-- and --
RewriteCond %{HTTPS} !on
RewriteRule ^(.*)$ [domainB.com...] [R=301,L]
The security certificate is only valid for domainB, so when I try to access [domainA.com...] in Firefox, I get the 'ssl_error_bad_cert_domain' error page. Ideally, the site should be redirected to [domainB.com...] before that error occurs.
Does anyone have any ideas or suggestions I could try? I have searched around for hours and was unable to find something specific to my situation.
Thanks in advance,
Precar.
RewriteCond %{HTTP_HOST} ^(www\.)?domainA\.com
RewriteRule ^(.*)$ http://domainB.com/$1 [R=301,L]
So, I suspect that your code is not located in a location where it will be executed for HTTPS requests. Be aware that with some server configurations, the SSL and non-SSL "sites" are stored in separate directory structures and have different DocumentRoot directories.
Jim