After updating the module to 1.4, redirects stopped working for websites installed in subdirectories.

For example, if I have http://localhost/test as a Drupal root, and try to access http://localhost/test/admin, I'm redirected to http://localhost/test/user/login?destination=/test/admin instead of http://localhost/test/user/login?destination=admin, which in turn causes login form to be submitted to http://localhost/test//test/admin, and I get a 404 error.

The problem seems to be caused by the change in r4032login_redirect (line 92) from drupal_urlencode($_REQUEST['q']) to request_uri(). Reverting this line back to its previous version resolves the problem.

Comments

benkewell’s picture

Having the same issue. Suggestion by m.bielawski solves the problem.

This is very anonying as I have a lot of websites installed in subdirectories. Hope this can be fixed as soon as possible.

jippie1948’s picture

The same problem on a multilingual site. Suggestion by m.bielawski solves the problem.

hgneng’s picture

Not sure whether my solution in D7 works for you:
http://drupal.org/node/1409866

lotyrin’s picture

Title: 1.4 Breaks redirection » Doesn't work in subdirectory install
Version: 6.x-1.4 » 7.x-1.x-dev
herr lehmann’s picture

I was able to use the suggested fix from #3, but needed needed to integrate the _r4032login_remove_language() function to strip my language prefix.

// get the path realitve to the drupal root
$path = request_uri();
// check if the drupal installation is a sub-directory installation http://drupal.org/node/1409866

if (strpos($path, $base_path) === 0) {
	$path = substr($path, strlen($base_path));
}
// strip any language prefix
$path = _r4032login_remove_language($path);

It would be great if this could be integrated into future releases. Would it be of any help if I created a patch for that?

deekayen’s picture

I generally don't pay any attention until someone puts in enough effort to upload a patch.

herr lehmann’s picture

Ok, here we go - trying to raise your attention, deekayen ;)
I created a patch for my suggestion (#5). Tell me if I can provide any further help.

deekayen’s picture

Status: Active » Closed (duplicate)

Specific to the patch you submitted, Drupal coding standards dictate 2 space indents, not tabs. Otherwise, the solution to this issue is stomping in the same lines of code as another, prior issue.

#339120: Redirect issues

lotyrin’s picture

This was fixed in the other issue