Jump to:

23459 Posts in 18906 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Redirect on login to current page. Redirector Page. Variable URL on Redirector?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 630 Views
  • forumq42
    Avatar
    Community Member
    12 Posts

    Redirect on login to current page. Redirector Page. Variable URL on Redirector? Link to this post

    So we have multiple sites.

    The behavior of one has a footer template so that a Login link appears at the bottom of every page. After successful login, the user is redirected to a logged in version of the page they clicked the login link from.

    The <a href> in the footer.ss looks like:
    <a href="Security/login?BackURL=$UrlLink" title="Login">Login</a>

    So the page to return to when the page is rendered has been dynamically generated. So it will be http://mysite.com/admin/show/<whatever_page#_currently_on>;

    This works quite well.

    However another site we have hasn't got the login links set up that way, but rather there is a 'Login' page within the site tree of the CMS that is a Redirector Page. The page it is set to go to is basically our home page. Under the 'Behavior' tab the ' Show in Footer Menu?' is checked.

    On the Redirector Page under Content -> Main tab it looks like:

    This page will redirect users to another page:
    - Redirect to
    - - Other website URL
    - - - mysite.com

    So that behavior makes sense. However it would be much preferable to get redirected after the login to the page one clicked the login link from.

    My question is, from within the CMS, on the redirector page, is their a way to redirect to a dynamically generated page? So the link ends up dynamically generated to correspond to whatever page you are on?

    So it looks like:

    This page will redirect users to another page:
    - Redirect to
    - - Other website URL
    - - - http://mysite.com/admin/show/<whatever page # currently on>

    I'm trying permutations of:
    https://mysite.com/Security/login?BackURL=%2Fhome

    However I just end up back on the home page after login.

    When I use:

    https://mysite.com/Security/login?BackURL=$UrlLink

    the result is a white page in the browser displaying just this line:

    The action '$UrlLink' does not exist in class Security

    630 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.