Welcome Guest, Not a member yet? Register   Sign In
http to htts
#1
Question 

I make a simple php apps by CodeIgniter 2.2.1.

I want to config with ssl.
so i want to help to configure with ssl/https...

please help me about this. pls
Reply
#2

everything i'm doing is https. its very easy -- you can set it in the config/config in base_url

but here is my 'insider' tip -- leave base_url in config.php blank and assign the base url in index.php like this:

PHP Code:
$assign_to_config['base_url'] = 'https://website.com/'

that way -- you can have local and server versions of your application -- and the url is always correct because you are setting it in the index.php file which is not inside the application folder. you can also easily switch versions:

PHP Code:
$assign_to_config['base_url'] = 'https://website.com/beta/'
Reply
#3

Instead of doing a, imo, ugly work around I would recommend that you use a .htaccess to redirect all HTTP requests to HTTPS.

You should not need to do anything else in CodeIgniter. However, don't forget to load any external assets (css, js and more) over HTTPS, or they will not load.

Here is all code you need in the .htaccess file
Code:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Some more information can be found here: https://stackoverflow.com/questions/4398...od-rewrite
Reply
#4

(03-31-2015, 11:21 AM)silentium Wrote: However, don't forget to load any external assets (css, js and more) over HTTPS, or they will not load.

Or just leave the protocol off when loading js/css/images/other assets, and start with a double slash, like "//css/yourcss.css" instead of "https://css/yourcss.css", and the browser will use http or https automatically depending on what the current protocol in the url is so it will work with either with no other changes. That's pretty nice if you have some pages with https and some without.
Reply
#5

Ok thanks for help...
Reply




Theme © iAndrew 2016 - Forum software by © MyBB