cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP to HTTPS with multiple websites

SOLVED

HTTP to HTTPS with multiple websites

Hi all....

I've tried several .htaccess changes to try and get this to work but failed.

I have one Magento 1.9.4.1 installation with three different websites.
One of the sites uses an SSL Certificate and I want this site to use https on ALL pages.

The code on my index.php uses the following for each site:

switch($_SERVER['HTTP_HOST']) {
case 'website2.co.uk':
case 'www.website2.co.uk':
Mage::run('website2', 'website');
break;
default:
Mage::run('base', 'website');
break;
default:
Mage::run();
break;
case 'website3.co.uk':
case 'www.website3.co.uk':
Mage::run('website3', 'website');
break;
default:
Mage::run();
break;

The default website being the one I want to use https on.

I manage my stores as seen in my screenshot attached.store.jpg

If I change the default website unsecure url to https, all internal links go to the homepage.

Can anyone suggest the correct code for the .htaccess so that all internal and external (http) links use the https correctly please?

Many thanks in advance.

Andy

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: HTTP to HTTPS with multiple websites

Hello @Andy_Acute 

 

remove all thing whatever you did into access

 

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 

and then change all nonsecure and secure into the admin with https



if works then mark as solution


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

View solution in original post

3 REPLIES 3

Re: HTTP to HTTPS with multiple websites

Hello @Andy_Acute 

 

remove all thing whatever you did into access

 

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] 

and then change all nonsecure and secure into the admin with https



if works then mark as solution


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: HTTP to HTTPS with multiple websites

Hi Sunil

Thank you for your response.

I managed to get it working by using the below.

This worked for my particular setup.

Thanks again..

 

RewriteEngine on
RewriteCond %{HTTP_HOST} ^websitename\.co.uk [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.websitename.co.uk/$1 [R,L]

 

Re: HTTP to HTTPS with multiple websites

Hello @Andy_Acute 

 

I glad my solution work.

 

Can you please accept as solution.

 

Thanks

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer