[Ilugc] [Ilug-C] Doubt in Code-Igniter [php]

  • From: mehul.n.ved@xxxxxxxxx (Mehul Ved)
  • Date: Sat, 8 Mar 2014 19:27:14 +0000

On Sat, Mar 8, 2014 at 1:45 PM, Magendra Varman
<kmagendravarman at gmail.com> wrote:

How to change Base_URL in Code-Igniter?
I did search through internet, but i can't get proper solution, what to do?

Base URL is defined in application/config/config.php. Why do you want
to change it? From version 2.1 onwards it's auto detected and that
should work well.
That said, here's the base_url I use in my applications and it is
portable to any hostname without fiddling with config files.
$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']);


-- 
With Regards,
Mehul Ved

Other related posts: