diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-05-31 13:05:06 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-05-31 13:05:06 +0000 |
commit | 82019d89fb67be280a12a98d97ad0a6651539a0c (patch) | |
tree | 9f0029ee812a45623a9f3a6eac5ccaa240747360 /includes | |
parent | 39f6a9e79a72ff17907ffaddeadf1193ca5f1f8f (diff) | |
download | brdo-82019d89fb67be280a12a98d97ad0a6651539a0c.tar.gz brdo-82019d89fb67be280a12a98d97ad0a6651539a0c.tar.bz2 |
- Omit "index.php" when using Apache. Patch by Al.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/includes/common.inc b/includes/common.inc index 66152b3c4..aeec31e8a 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -840,18 +840,29 @@ function form_weight($title = NULL, $name = "weight", $value = 0, $delta = 10, $ function url($url = NULL, $query = NULL) { global $base_url; + static $script; + + if (empty($script)) { + /* + ** On some webservers such as IIS we can't omit "index.php". As such we + ** generate "index.php?q=foo" instead of "?q=foo" on anything that is not + ** Apache. + */ + $script = (strpos($_SERVER["SERVER_SOFTWARE"], "Apache") === false) ? "index.php" : ""; + } + if (variable_get("clean_url", "0") == "0") { if (isset($url)) { if (isset($query)) { - return "$base_url/index.php?q=$url&$query"; + return "$base_url/$script?q=$url&$query"; } else { - return "$base_url/index.php?q=$url"; + return "$base_url/$script?q=$url"; } } else { if (isset($query)) { - return "$base_url/index.php?$query"; + return "$base_url/$script?$query"; } else { return "$base_url/"; @@ -869,7 +880,7 @@ function url($url = NULL, $query = NULL) { } else { if (isset($query)) { - return "$base_url/index.php?$query"; + return "$base_url/$script?$query"; } else { return "$base_url/"; |