Can someone tell me why I would need to set $base_url in ./sites/default/settings.php?
settings.php says its optional, and my site works fine without it (it's defaulted to #commented#), but I am confused as to why it even exists?

Comments

johnhanley’s picture

Defining $base_url used to be required, but since 5.x Drupal is smart enough to figure out the base URL on its own. It's still there for particular complicated or fussy installations where Drupal is unable to decipher the correct base URL on its own.

ChrisRut’s picture

So it's not needed at all anymore?
Is there no reason to use it?
Why wouldn't they have removed it from settings.php?

Garrett Albright’s picture

As Bacteria Man said (hell of a username, by the way… bet it gets you all the ladies):

It's still there for particular complicated or fussy installations where Drupal is unable to decipher the correct base URL on its own.

johnhanley’s picture

My username is from the Japanese Anpanman character "Baikinman" ("Germ Man" or "Bacteria Man"). Don't ask me why I chose it--couldn't think of anything else at the time.

And my wife is quite lovely so I guess it hasn't hurt me with "the ladies" either. ;-)