Post by vaidyamanishjoshi » Thu Jul 12, 2018 9:40 pm

I am using opencart

My store is installed in a folder. e.g.

In my root domain htaccess, I have added following code to force www and to force https, But it is not working for /eshop

if user types, he get redirected to

but if he types url for shop directly like, he is expected to redirect
but it is not working

code in htaccess in root folder is as follow :

Code: Select all

RewriteEngine on
#Force www:

RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301,NC]

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.myrootdomain\.com$ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

New member


Tue Jun 09, 2015 2:47 am

Post by Qphoria » Thu Jul 12, 2018 10:05 pm

I use this

Code: Select all

RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
You can just use it as is on any site because you don't need to hardcode the actual domain name. HTTP_HOST is a variable.

Donate!|OpenCart Basics|GeoZones

User avatar


Tue Jul 22, 2008 3:02 am
Who is online

Users browsing this forum: Mike Guenther and 25 guests