diff options
author | Dries Buytaert <dries@buytaert.net> | 2011-05-01 06:08:25 -0400 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2011-05-01 06:08:25 -0400 |
commit | 3f154706a3da1084b304cfc0b36fa375471e2f19 (patch) | |
tree | 4cc1c72caa5d3ed6d9de629b9e4589b68ba1fce8 /includes | |
parent | 9888e8884e7142509d28575c8c97854f6357d6bd (diff) | |
download | brdo-3f154706a3da1084b304cfc0b36fa375471e2f19.tar.gz brdo-3f154706a3da1084b304cfc0b36fa375471e2f19.tar.bz2 |
- Patch #711650 by marcvangend, cha0s: when index.php appears in the URL (or is automatically added by the server) users get a 'page not found' message.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index e8ea605b5..b73bec68c 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -2363,6 +2363,8 @@ function language_default($property = NULL) { * base_path() returns "/drupalfolder/". * - http://example.com/path/alias (which is a path alias for node/306) returns * "path/alias" as opposed to the internal path. + * - http://example.com/index.php returns an empty string (meaning: front page). + * - http://example.com/index.php?page=1 returns an empty string. * * @return * The requested Drupal URL path. @@ -2384,11 +2386,19 @@ function request_path() { $path = $_GET['q']; } elseif (isset($_SERVER['REQUEST_URI'])) { - // This is a request using a clean URL. Extract the path from REQUEST_URI. + // This request is either a clean URL, or 'index.php', or nonsense. + // Extract the path from REQUEST_URI. $request_path = strtok($_SERVER['REQUEST_URI'], '?'); $base_path_len = strlen(rtrim(dirname($_SERVER['SCRIPT_NAME']), '\/')); // Unescape and strip $base_path prefix, leaving q without a leading slash. $path = substr(urldecode($request_path), $base_path_len + 1); + // If the path equals the script filename, either because 'index.php' was + // explicitly provided in the URL, or because the server added it to + // $_SERVER['REQUEST_URI'] even when it wasn't provided in the URL (some + // versions of Microsoft IIS do this), the front page should be served. + if ($path == basename($_SERVER['PHP_SELF'])) { + $path = ''; + } } else { // This is the front page. |