0

I'm using an OpenCart 2 theme and my PHP skills aren't great. My problem:

When I type example.com in, the SSL lock isn't displayed and my Font Awesome fonts do not display. So the shopping cart icon just shows as a blank square.

However, if I click example.com's logo or manually type in https://example.com -- the lock displays and the fonts show up. Everything works as it should.

How do I get the site to go straight to https://example.com when a user types in example.com?

I ran a test on the SSL and there aren't any problems with it, it shows everything sending as secure.

numero9
  • 5
  • 3
  • Sample of code that does not work? – E_p Jan 28 '15 at 20:25
  • I don't know what I would edit to do this. This is an ecommerce site and I don't want any user being able to access it without https. The domain automatically goes to http version, but the https works if you type it in https:// example.com or example.com/index.php but not when you just type in example.com – numero9 Jan 28 '15 at 20:27
  • possible duplicate of [Force SSL/https using .htaccess and mod\_rewrite](http://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite) – Jhuliano Moreno Jan 28 '15 at 20:59

1 Answers1

0

In your vhost configuration, or in your .htaccess file, add an Apache redirect rule:

RewriteEngine on RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R=301,L]

jdp
  • 3,446
  • 2
  • 30
  • 54
  • Thanks I figured changing the .htaccess would do it but will it create any vulnerabilities security-wise? Sorry I'm ignorant on this. – numero9 Jan 28 '15 at 20:33
  • Not that I can think of. – jdp Jan 28 '15 at 20:54
  • @user3167513 no, it doesn't create any security problems. Anyways you could look at other options: http://stackoverflow.com/questions/4398951/force-ssl-https-using-htaccess-and-mod-rewrite – Jhuliano Moreno Jan 28 '15 at 20:58
  • @user3167513: Unless your payment gateway callbacks are using HTTPS this is almost certainly going to mess them up – Jay Gilford Jan 28 '15 at 21:08
  • I copied this and it worked sometimes but now it is re-directing to just to: https:// www./ Any ideas? – numero9 Jan 29 '15 at 03:59