• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why do you need to manually set base_url in config ?

#1
[eluser]bernstable[/eluser]
Been puzzling over this and I must confess to not being able to understand why you need to manually set base_url in the config file. Surely the following ensures that the base url is set correctly whether viewing locally, remotely or if you have moved your application to a brand new and shiny url Wink

$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'];

And with my limited knowledge I'd have thought that the above would be the most logical default setting in the CI files as it catches all.

Am I totally missing the point? Can anyone tell me why I shouldn't be doing that? (Go easy on me I've only just started with CI Smile but I'm loving it)

#2
[eluser]GSV Sleeper Service[/eluser]
no, that makes perfect sense, and it's quite a well known 'trick'.
not sure why it's not there by default, it's just one of those CodeIgniter mysteries, like "WTF is a smiley helper doing in a framework?"*


* I am the chairman and founder of The Ban Graphical Emoticons Foundation.

#3
[eluser]Bogdan Tanase[/eluser]
What if you have multiple applications on the same domain?

http://mydomain/application1

http://mydomain/application2

#4
[eluser]GSV Sleeper Service[/eluser]
[quote author="Bogdan Tanase" date="1233680748"]What if you have multiple applications on the same domain?

http://mydomain/application1

http://mydomain/application2[/quote]

I'd use subdomains

#5
[eluser]bernstable[/eluser]
[quote author="GSV Sleeper Service" date="1233680505"]"WTF is a smiley helper doing in a framework?"*
[/quote]

There goes my next post!

#6
[eluser]Bogdan Tanase[/eluser]
I would too, but there are cases where subdomains are not available.

For example, at work in our intranet we cannot (or we are not allowed) to use subdomains so we serve the pages as in the previous example.

Don't get me wrong, I would be very interested in a smart solution for this type of configuration Wink


[quote author="GSV Sleeper Service" date="1233680973"]

I'd use subdomains[/quote]


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.