CodeIgniter Forums

Full Version: How do I force https on live site, but not on local
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,

I have a site which requires the user to always use https but I don't want this to happen in my local development version as getting SSL to work locally has been a real hassle.

What would you recommend I do to have it force SSL in the live version, but not the local version?

Thanks!
Rob
(09-02-2017, 05:04 PM)rob.maric Wrote: [ -> ]Hi there,

I have a site which requires the user to always use https but I don't want this to happen in my local development version as getting SSL to work locally has been a real hassle.

What would you recommend I do to have it force SSL in the live version, but not the local version?

Thanks!
Rob

https://www.codeigniter.com/user_guide/l...vironments

check the environments.
Besides what you can do in CodeIgniter (basic configuration), you can force HTTPS on the live site by adding the following to your .htaccess file. Obviously only works for Apache type servers with mod rewrite enabled:


Code:
# Entire site is secure
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://example.com/$1 [R,L]