When creating a redirect to "node/1" which has the path "members/tci-new-members" it ends up redirecting to "memberstci-new-members" because my site is installed in the root directory and the $base variable is "/".

I fixed it by changing line 135 from

$url = str_replace($base, '', url($path, $url));

to

$url = url($path, $url);

but I understand that your thing has a purpose so it's not a great fix.

Now it redirects to http://mysite.com//members/tci-new-members (notice the two '/'s). I can't work out why this is because the url function shouldn't return an absolute value but it is.

Let me know if you need any more information.

Comments

Schoonzie’s picture

I made a few changes and changing line 135 to
$url = substr_replace(url($path, $url), '', 0, strlen($base));
works fine. I haven't tested it for other sites with other languages or on sites in sub directories, but I think it should work.

rsvelko’s picture

Status: Active » Fixed

using a preg_replace in the latest 2.6. It will work as expected - I am 100% sure.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ChrisRut’s picture

Version: 6.x-2.5 » 6.x-2.6
Status: Closed (fixed) » Active

Absolute URL Redirects in 6.x-2.6 have two // (forwardslashes) ?
i.e.
Static Destination URL = http://mysite.com/node/123
Redirects to: http://mysite.com//node/123 (Notice double forwardslashes)

However if you use Relative URL, it works fine:
Static Destination URL = node/123
Redirects to: http://mysite.com/node/123

rsvelko’s picture

make them all w/o a / at the beginning.

The next maintainer should add a stripping function that takes care of this.

ChrisRut’s picture

Status: Active » Fixed

This issue seems to be resolved with the latest version (6.x-2.10)

ChrisRut’s picture

Come to find out it was upgrading core from 6.15 to 6.16 that resolved this. Probably not the upgrade to Login_Destination (2.6>2.10). Either way it's fixed :)
Most likely having to do with the changes to common.inc drupal_goto():

--- drupal-6.15/includes/common.inc 
+++ drupal-6.16/includes/common.inc 
@@ -1,5 +1,5 @@
 <?php
-// $Id: common.inc,v 1.756.2.74 2009/12/16 20:47:10 goba Exp $
+// $Id: common.inc,v 1.756.2.79 2010/03/04 00:15:28 goba Exp $
 
 /**
  * @file
@@ -311,11 +311,21 @@
  */
 function drupal_goto($path = '', $query = NULL, $fragment = NULL, $http_response_code = 302) {
 
+  $destination = FALSE;
   if (isset($_REQUEST['destination'])) {
-    extract(parse_url(urldecode($_REQUEST['destination'])));
+    $destination = $_REQUEST['destination'];
   }
   else if (isset($_REQUEST['edit']['destination'])) {
-    extract(parse_url(urldecode($_REQUEST['edit']['destination'])));
+    $destination = $_REQUEST['edit']['destination'];
+  }
+
+  if ($destination) {
+    // Do not redirect to an absolute URL originating from user input.
+    $colonpos = strpos($destination, ':');
+    $absolute = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($destination, 0, $colonpos)));
+    if (!$absolute) {
+      extract(parse_url(urldecode($destination)));
+    }
   }
 
   $url = url($path, array('query' => $query, 'fragment' => $fragment, 'absolute' => TRUE));

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.