Post by MAD King » Wed Jan 17, 2018 12:00 am

Hello,

I would need some help. I am not able to figure it out.
I have SSL installed and it is always pointing to https, but it keeps it https://domain.com when entered and I would like to refer it to https://www.domain.com
My htaccess looks like this:

Code: Select all

Options +SymLinksIfOwnerMatch

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none
OC Version 2.3.0.2

Thank you

New member

Posts

Joined
Wed Nov 19, 2014 10:55 pm

Post by IP_CAM » Wed Jan 17, 2018 8:18 am

Try this:
AFTER:

Code: Select all

RewriteBase /
EITHER, if http:// used:

Code: Select all

#Force (http host) non www to www (optional)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
OR, if https:// used:

Code: Select all

#Force (https host) non www to www (optional)
RewriteCond %{HTTPS} on
RewriteCond %{HTTPS_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTPS_HOST}/$1 [R=301,L]
Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'600+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by MAD King » Wed Jan 17, 2018 8:25 am

Hello Ernie,

thank you. When I add your https code and enter https://domain.com I get just https://www. and not the expected https://www.domain.com

New member

Posts

Joined
Wed Nov 19, 2014 10:55 pm

Post by IP_CAM » Wed Jan 17, 2018 8:27 am

then, change this:

Code: Select all

RewriteRule ^(.*)$ https://www.%{HTTPS_HOST}/$1 [R=301,L]
to:

Code: Select all

RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
and try again. I never used https yet, so I cannot test it.
Ernie

Please don't send me OC Forum Personal Messages, just contact: jti@jacob.ch
---
OC 1.5.6.5 LIGHT Test Site: http://www.bigmax.ch/shop/
OC 1.5.6.5 V-PRO Test Site: http://www.openshop.li/shop/
My Github OC Site: https://github.com/IP-CAM
2'600+ FREE OC Extensions on the World's largest Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by MAD King » Wed Jan 17, 2018 8:39 am

Weird. Now I get a https://www.www.domain.com
when I use

Code: Select all

#Force (https host) non www to www (optional)
RewriteCond %{HTTPS_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

New member

Posts

Joined
Wed Nov 19, 2014 10:55 pm

Post by michael2820 » Sun May 19, 2019 6:32 pm

not a good idea to suggest something, when you are not SURE about it

--- please reply only with verified data, that is: no 'I think', 'maybe' etc. ---


User avatar
Active Member

Posts

Joined
Sun May 15, 2011 8:16 pm
Location - Denmark ver. 2.1.0.2

Post by groteschatten » Sun Jun 23, 2019 5:11 am

In my htaccess I put:

Code: Select all

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [L,R=301]

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [L,R=301] 
Works perfect for me, let me know if it helps.

Running Opencart 2.3 store at https://www.groteschatten.com
Grote Schatten


Newbie

Posts

Joined
Sat Jun 08, 2019 9:10 pm
Location - Flanders, Belgium

Post by EvolveWebHosting » Mon Jun 24, 2019 9:38 pm

Update both of your config.php files to use www in the HTTP and HTTPS sections of the file as well.

Image
Take a close look at our domain pricing. It's cheaper than most of the 'big name' registrars.
Detailed guide on how to install Opencart


User avatar
Active Member

Posts

Joined
Fri Mar 27, 2015 11:13 pm
Location - Denver, Colorado, USA
Who is online

Users browsing this forum: No registered users and 4 guests