Skip to content
Snippets Groups Projects
Commit 82019d89 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Omit "index.php" when using Apache.  Patch by Al.
parent 39f6a9e7
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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/";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment