return to previous URL after logging out


I’ve tried setting returnUrl in many ways including defining it in main layout like bellow but no matter what I do atfer logging out depending on what browser I use it returns to either home page, 404 or for some weird reason tries to load favicon.ico

this is what I’ve tried:




and in the logout controller, after logging the user out, I’ve tried to execute following codes




Reason why I want to return to the previous/current page after logging-out is because I’ve implemented xPortlet and I have login box on header layout viewable site-wide, login works fine since it refreshes the page, but the same refresh code for logout results in infinite loop

Any help would be appreciated

Try this,


request->urlReferrer Works like a charm

Thank you, much appreciated :)