Force store to https and www
Posted: Thu Jul 12, 2018 9:40 pm
I am using opencart 3.0.2.0
My store is installed in a folder. e.g. www.myrootdomain.com/eshop
In my root domain htaccess, I have added following code to force www and to force https, But it is not working for /eshop
e.g.
if user types myrootdomain.com, he get redirected to https://www.myrootdomain.com
but if he types url for shop directly like myrootdomain.com/eshop, he is expected to redirect https://www.myrootdomain.com/eshop
but it is not working
code in htaccess in root folder is as follow :
My store is installed in a folder. e.g. www.myrootdomain.com/eshop
In my root domain htaccess, I have added following code to force www and to force https, But it is not working for /eshop
e.g.
if user types myrootdomain.com, he get redirected to https://www.myrootdomain.com
but if he types url for shop directly like myrootdomain.com/eshop, he is expected to redirect https://www.myrootdomain.com/eshop
but it is not working
code in htaccess in root folder is as follow :
Code: Select all
RewriteEngine on
#Force www:
RewriteCond %{HTTP_HOST} ^myrootdomain.com [NC]
RewriteRule ^(.*)$ https://www.myrootdomain.com/$1 [L,R=301,NC]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.myrootdomain\.com$ [NC]
RewriteRule ^(.*)$ https://www.myrootdomain.com/$1 [L,R=301]