standardize, add examples, and cross-link docs for $base_path, $base_root, $base_url

Created on 6 September 2013, over 11 years ago
Updated 3 April 2025, about 1 month ago

API pages:

https://api.drupal.org/api/drupal/developer%21globals.php/global/base_pa...
https://api.drupal.org/api/drupal/developer%21globals.php/global/base_ro...
https://api.drupal.org/api/drupal/developer%21globals.php/global/base_url/8

I can never remember which one is which. It's also not that clear reading all three:

- The base path of the Drupal installation.
- The root URL of the host, excluding the path.
- The base URL of the Drupal installation.

Is there a difference between 'root URL' and 'base URL'? If these are the same thing -- I suspect they are -- then the language should be standardized.

These three could all do with examples too, so for a site at http://example.com/drupal, you get:

$base_url => http://example.com/drupal

$base_root => http://example.com

$base_path => /drupal

Finally, they should be cross-referenced, so if the one you've found isn't the one you want, you can find the one you want.

🐛 Bug report
Status

Closed: outdated

Component

API documentation files

Created by

🇬🇧United Kingdom joachim

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024