4.6.x bootstrap.inc request_uri()
4.7.x bootstrap.inc request_uri()
5.x bootstrap.inc request_uri()
6.x bootstrap.inc request_uri()
7.x bootstrap.inc request_uri()

Since $_SERVER['REQUEST_URI'] is only available on Apache, we generate an equivalent using other environment variables.

7 calls to request_uri()
page_cache_fastpath in developer/hooks/core.php
Outputs a cached page.
page_get_cache in includes/bootstrap.inc
Retrieve the current page from the cache.
page_set_cache in includes/common.inc
Store the current page in the cache.
system_elements in modules/system/system.module
Implementation of hook_elements().
theme_install_page in includes/theme.maintenance.inc
Generate a themed installation page.

... See full list


includes/bootstrap.inc, line 913
Functions that need to be loaded on every Drupal request.


function request_uri() {
  if (isset($_SERVER['REQUEST_URI'])) {
    $uri = $_SERVER['REQUEST_URI'];
  else {
    if (isset($_SERVER['argv'])) {
      $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['argv'][0];
    elseif (isset($_SERVER['QUERY_STRING'])) {
      $uri = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];
    else {
      $uri = $_SERVER['SCRIPT_NAME'];

  // Prevent multiple slashes to avoid cross site requests via the FAPI.
  $uri = '/' . ltrim($uri, '/');
  return $uri;