Post by sooty » Wed Dec 08, 2021 9:53 pm

I have a V2.3.0.2 installation running two sites using the multistore feature.

The primary domain (www.domain1.com) redirects correctly, all versions

http://domain1.com
https://domain1.com
http:// www.domain1.com
https://www.domain1.com
all route to the store under https://www.domain1.com. This is configured in .htaccess.

However, the secondary store (www.domain2.com) can only be accessed when https://www.domain2.com is entered into the browser. All of the other variations route to https:///www.domain1.com

so,
http://domain2.com
https://domain2.com
http:// www.domain2.com
all end up at https://www.domain1.com

Domains and hosting are all managed in a cpanel environment.

Is this something I need to correct in .htaccess or in cpanel?

all pointers appreciated

New member

Posts

Joined
Fri Sep 21, 2012 4:59 am

Post by ADD Creative » Wed Dec 08, 2021 10:01 pm

Yes, it's probably a problem with your redirects in htaccess.

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by straightlight » Wed Dec 08, 2021 11:01 pm

Or inside your addon domains.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by sooty » Thu Dec 09, 2021 1:08 am

ADD Creative wrote:
Wed Dec 08, 2021 10:01 pm
Yes, it's probably a problem with your redirects in htaccess.
the current .htaccess file contains,

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*) https://www.domain1.com%{REQUEST_URI} [R=301,L,NE]
RewriteBase /

No mention of domain2.com. I'll be honest, I'm not going to try and guess what is missing!

New member

Posts

Joined
Fri Sep 21, 2012 4:59 am

Post by sooty » Thu Dec 09, 2021 1:11 am

straightlight wrote:
Wed Dec 08, 2021 11:01 pm
Or inside your addon domains.
both domains are installed as Domains, and have the Opencart directory as their root directories.

both domains are also in Addon Domains, again both have the Opencart directory as their root directories.

New member

Posts

Joined
Fri Sep 21, 2012 4:59 am

Post by ADD Creative » Thu Dec 09, 2021 2:38 am

Try something like.

Code: Select all

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

RewriteCond %{HTTP_HOST} ^domain1\.com$
RewriteRule ^(.*)$ https://www.domain1.com/$1 [E=HTTPS,R=301,L]

RewriteCond %{HTTP_HOST} ^domain2\.com$
RewriteRule ^(.*)$ https://www.domain2.com/$1 [E=HTTPS,R=301,L]

www.add-creative.co.uk


Expert Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by sooty » Thu Dec 09, 2021 3:30 am

ADD Creative wrote:
Thu Dec 09, 2021 2:38 am
Try something like.

Code: Select all

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

RewriteCond %{HTTP_HOST} ^domain1\.com$
RewriteRule ^(.*)$ https://www.domain1.com/$1 [E=HTTPS,R=301,L]

RewriteCond %{HTTP_HOST} ^domain2\.com$
RewriteRule ^(.*)$ https://www.domain2.com/$1 [E=HTTPS,R=301,L]
Thank you so much, that's fixed it! ;D

New member

Posts

Joined
Fri Sep 21, 2012 4:59 am
Who is online

Users browsing this forum: No registered users and 30 guests