--- lib/TWiki/LoginManager/ApacheLogin.pm 2010-12-08 11:54:48.000000000 +0000 +++ lib/TWiki/LoginManager/ApacheLogin.pm 2010-12-08 11:47:23.000000000 +0000 @@ -87,11 +87,13 @@ # the path info, and the query string. All three query # variables are in the list of the canonical request meta # variables in CGI 1.1 (also provided by TWiki::Request). - my $url = $twiki->getScriptUrl(1, $scriptName); + + my $url = $twiki->getScriptUrl(1, $scriptName)."/".$twiki->{webName}."/".$twiki->{topicName}; + if( $url && $url =~ m!(.*/$scriptName)([^?]*)! ) { # $url should not contain query string as it gets appended # in TWiki::redirect. Script gets 'auth' appended. - $url = "$twiki->{urlHost}${1}auth$2"; + $url = "${1}auth$2"; } else { if( $twiki->{request}->action !~ /auth$/ ) { $url = $twiki->{urlHost}.'/'.$twiki->{request}->action . 'auth'; @@ -109,7 +111,9 @@ } # Redirect with passthrough so we don't lose the original query params $twiki->redirect( $url, 1 ); + return 1; + } return undef; }