Posted Date:20-06-2017

In this post we will explain dynamically set codeigniter baseurl.

Step 1: navigate to application/config and open config.php file edit $config[‘base_url’] using following code.

$config['base_url'] = ((isset ( $_SERVER ['HTTPS'] ) && $_SERVER ['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://" . $_SERVER ['HTTP_HOST'];
$config['base_url'] .= str_replace ( basename ( $_SERVER ['SCRIPT_NAME'] ), "", $_SERVER ['SCRIPT_NAME'] );

 

Leave a Reply

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny