How to redirect user after login in Joomla 2.5

2019-08-17 04:24发布

问题:

I have created custom Login module in Joomla 2.5 which appears using fancybox.

Our site is using SEF URL. Now my problem is user is not redirecting to previous page where popup is trigger.

I have used following code in my module and passed it to "return" parameter of login form.

$uri =& JFactory::getURI();
$redirectUrl = urlencode(base64_encode($uri->toString()));

<input type="hidden" name="return" value="<?php echo $redirectUrl; ?>" />

But it redirect with some value appended at the end of URL and shows 404 page.

e.g.

localhost/xxx/xxxx.html

TO

localhost/xxx/xxxx.html7

回答1:

try this

$redirectUrl = base64_encode($uri->toString());



回答2:

you can remove the last character?

$char = strlen($redirectUrl) - 1;