0

I guess the title says it all. I want anytime the browser to makes a request starting with http:// to change to https://

I am using the F3 framework, so I have routes set up. I'm not sure if I should add a route for this? If so, what would the line look like?

Or should I modify the .htaccess file in the f3 document root? I have been trying this route and it is not working. All browser requests with http:// are remaining that way. I have been modifying the .htaccess in the f3 folder according to the following:

How to redirect all HTTP requests to HTTPS

And, it's not working at all.

Community
  • 1
  • 1
whistler
  • 876
  • 2
  • 15
  • 31
  • Actually, there was an .htaccess file higher up in the file hierarchy and it was ignoring the .htaccess file in the f3 folder. However, with the redirects in place, it is not loading some of my javascript files. Firebug console shows "Blocked loading mixed active content 'http://myurl/myfile.js" -- why aren't these file requests being rerouted as well? – whistler Jul 10 '15 at 20:16
  • you have to load all external js files from https too, to get around this issue – ikkez Jul 10 '15 at 21:27

1 Answers1

1

You need to use .htaccess in your public_html or "root" that is publicly accessible in order to modify for http redirect to https.

Something like this:

RewriteEngine On
RewriteCond %{SERVER_PORT} !=443
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com*$ [NC]
RewriteRule ^$ https://example.com%{REQUEST_URI} [R,L]