Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14343

Multi domain in CodeIgniter with http/https

$
0
0
Hi all,

I have been used CI for 4 years. Today I will share my config for multi domain + http/https

The environment: CI 2.x/3.x + nginx web server

- In server side (nginx), you should config normal vhost for http/https (you can search with Google)
- In Application side, file config.php


PHP Code:
if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
    $protocol_ 'https';
else
    $protocol_ 'http';
$config['base_url'] = $protocol_.'://'.$_SERVER['HTTP_HOST'].'/'

Now you can access your application with many domain:
http://abc.com/
https://abc.com/
http://xyz.com/
https://xyz.com/
And no need config any more in application side

Hope all you like this topic Wink

Viewing all articles
Browse latest Browse all 14343

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>