drupalfun.com
HELP - save submit button takes page to dir above sub dir where Drupal is installed
The issue I have is when I go into an administer page and save it, the page goes to the wrong directory and not the sub directory. So it gives a page not found error. This has happened because of enabling clean URLs on windows IIS and adding the below code to settings.php
e.g. http://localhost/drupal/admin/user/permissions ---- goes to ----- http://localhost/admin/user/permissions
Does anyone know how to resolve this. Does the below code only work if Drupal is installed in the root web folder? Anyone know how to fix it?
// CONFIGURATION
$sub_dir = "/drupal/"; // enter a subdirectory, if any. otherwise, use ""
$active = 1; // set to 1 if using clean URLS with IIS
// CODE
if ($active && strstr($_SERVER["QUERY_STRING"], ";")) {
$qs = explode(";", $_SERVER["QUERY_STRING"]);
$url = array_pop($qs);
$parts = parse_url($url);
unset($_GET, $_SERVER['QUERY_STRING']); // remove cruft added by IIS
if ($sub_dir) {
$parts["path"] = substr($parts["path"], strlen($sub_dir));
}
$_GET["q"] = trim($parts["path"], "/");
$_SERVER["REQUEST_URI"] = $parts["path"];
if( array_key_exists( "query", $parts ) && $parts["query"] ) {
$_SERVER["REQUEST_URI"] .= '?'. $parts["query"];
$_SERVER["QUERY_STRING"] = $parts["query"];
$_SERVER["ARGV"] = array($parts["query"]);
parse_str($parts['query'], $arr);
$_GET = array_merge($_GET, $arr);
$_REQUEST = array_merge($_REQUEST, $arr);
}
}
Does anyone have any ideas?
- Login to post comments

