1

In my extension I am trying to implement the redirection after login outlined here (using the 'return' parameter): https://docs.joomla.org/How_do_you_redirect_users_after_a_successful_login%3F

My link to the login page is built correctly, and the return parameter is passed. I've double-confirmed that the destination link that is encoded is correct. But after login, it redirects to the user profile page instead of my desired location. I've checked the following:

  • menu item created for the login form set to use the "default" redirection -- which should allow an override
  • no other plugins that would potentially be controlling the redirection
  • SEF is enabled, though I've tried accessing the login page via both the SEF and non-SEF version and neither works

this issue is about the closest to what I'm seeing: Redirect users to the page pointed in the URL after login

It seems to suggest that the "return=" method is no longer working -- that you can't pass that param via $_GET.

can anyone:

  • provide suggestions for troubleshooting
  • confirm if the return method is still valid?

2 Answers 2

1

This may not answer your question fully since your situation is different - you are working on your own extension and I was just trying to use the User Log In Menu Type redirect fields but...

This morning I was pulling out my hair trying to get the redirect to work and it wasn't working for me. On top of that, it worked fine on the "dev" copy of the site, I was going crazy trying to figure out what's different between the two.

I then found this - https://issues.joomla.org/tracker/joomla-cms/11176#event-183024 and it solved my problem.

Quoting from the link above:

In 3.6, it is advised to always use the Menu Item field and not the internal URL. There can't be any error as it is simply the itemID of the menu item which is appended to the index.php? (+ the language in multilingual sites). If one has access to that menu item, then it will work fine.

So, I just used "index.php?Itemid=xxx" for the link and the redirect started working fine for me. Put the ID of the menu item you'd like to be redirected to.

Hopefully this helps someone else.

1
  • Thank you! I looked at some other solutions that said to use just the menu item ID, but without "Itemid=" that was not working. This fixed my problem. Commented Apr 28, 2018 at 21:04
1

This issue was introduced as part of the security fix in Joomla 3.4.6. The internal handling of validating internal and external uris was changed to address a security issue.

https://github.com/joomla/joomla-cms/issues/8689

So the code below will decide whether the redirect should happen or not.

// Don't redirect to an external URL.
if (!JUri::isInternal($data['return']))
{
    $data['return'] = '';
}

So you won't get redirected to target page unless your url:

  1. Starts with index.php or
  2. Starts with your full host name

Urls like http://test.com/testing/test.html or index.php?option=mycomponent should work, relative urls like /testing/test.html won't work.

Do the base64_decode of your return string and see what type of url it is.

Hope this helps.

2
  • The encoded URL is definitely constructed using index.php?option=etc. I've tried both referencing the full url with the domain or just the index.php path. It still does not respect the redirection. Commented Aug 27, 2016 at 13:10
  • Is it possible to post the encoded url?
    – Nagarjun
    Commented Aug 28, 2016 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.