Page 1 of 1

Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 3:22 am
by pex48
I've googled numerous websites for an answer. I've edited config.php files as stated in root and admin folder. Also placed a redirect instruction using this example.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^opencart.worldfortesting\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://opencart.worldfortesting.com/$1 [R,L]

It is redirecting to HTTPS in every format except when I type in http:// example.com

Any advice? Thanks

Re: Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 3:31 am
by straightlight
See this solution: http://forum.opencart.com/viewtopic.php ... 71#p632944 . Adjust the domain name to your domain name from the provided codes.

Re: Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 3:51 am
by pex48
Thanks for the reply. I sorted it with a different code I got from another search for general websites. Seems to work. :-)

Re: Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 8:32 pm
by pex48
Spoke too soon. Thought everything was fine. When I didn't get any orders overnight realised something's not right.

Went to website and found I couldn't add anything to the cart however many items I click on. Have now removed the forced redirect to SSL and all okay. If I put my website address in with https it goes there but when I go to any page or add an item it no longer shows as secure but the items are added. Presuming the issue is with the HTTPS version?

Just to clarify, did I need to edit the config.php files (in root & admin) as follows:
You need to locate the following section in both of your files:

// HTTPS
define('HTTPS_SERVER', 'http://yourdomain.com/');

Modify the line to include https instead of http:

// HTTPS
define('HTTPS_SERVER', 'https://yourdomain.com/');
Any ideas? Thanks!

Re: Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 9:26 pm
by straightlight

Re: Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 9:31 pm
by pex48
Update. The failure to add to cart is down to HTTPS not the re-direct. Opencart just not working with it. properly. SSL also selected in Opencart under 'server'.

Re: Force re-direction to HTTPS

Posted: Wed Jun 27, 2018 9:45 pm
by straightlight
Especially with the v3.x releases, the SSL protocol validations have been re-worked. It's an issue that's already been solved.